ZooKeeper相关资料

ZooKeeper【部署 01】单机版安装+配置+添加到service服务+开机启动配置(1) 当我学到一定基础,有自己的理解能力的时候,会去阅读一些前辈整理的书籍或者手写的笔记资料,这些笔记详细记载了他们对一些技术点的理解,这些理解是比较独到,可以学到不一样的思路。可以说是最科学最系统的学习路线,大家跟着这个大的方向学习准没问题。网安所有方向的技术点做的整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。观看零基础学习视频,看视频学习是最快捷也是最有效果的方式,跟着视频中老师的思路,从基础到深入,还是很容易入门的。系统服务配置文件里的。 阅读详情

ZooKeeper: enables coordination for distributed system

Similar to multithread programming, but shared nothing. Easier with a component provide share store, like ZooKeeper.


ZooKeeper manage data related to coordination, not for bulk storage



Master-Slave Key Problems:

1. Master Crashes

2. Slave Crashes

3. Communication Failure(Master and Slave cannot exchange message)


Master Failures: 

Store the state of the system at the time old primary master crashed.

Split-Brain Problem: more than one master running independently caused by false suspicion of master failed


Question: if there are 5 servers at beginning, when 3 separated from other 2, what will happen? will there be two separate master?(is this actually what split-brain means?) or just the group has the majority of 3?


Worker Failures:

Detect worker failure by master. If the computation has side effects, some recovery procedure might be necessary to clean up the state.


Communication Failure:

Reassigning a task may cause two workers executing the same task, which depends on application may unacceptable.

ephemeral state.

Cannot tell is a node is crashed or just be slow.


Summary of Master-Worker Tasks

1. Master Election

2. Crash Detection

3. Group Membership Management: figure out which workers are available, group member is worker

4. Metadata Management: master and worker be able to store assignments and execution statuses in a reliable manner



ZooKeeper Basics

ZooKeeper not provide primitives, but expose file system like API comprised for a small set of calls.

Recipe to denote these implementation of primitives


API

create /path data

delete /path

exists /path

setData /path data

getData /path

getChildren /path


Modes

Persistent

Ephemeral: delete if client created it crashes or simply closed the connection. (Cannot have children)

Sequential znode: tasks-1, tasks-2 ....


All modes: persistent, ephemeral, persistent-sequential, ephemeral-sequential


Watches and Notifications

Clients register to watch notification instead of POLLING.

【IMPORTANT】One-Shot Notification, Example:

A want to watch on /tasks, but tasks has changed before A successfully set the watch, A may lost the notification, if the notification is important for A, so A get status of /tasks when setting the watch


【IMPORTANT】Notification Guarantee, notifications are delivered to a client before any other change is made to the znode.


Question: What if the Notification is lost?


Versions

use version to check valid update



ZooKeeper Architecture

Client Library: responsible for talking to servers


ZooKeeper Quorums

In Quorum mode, ZooKeeper replicates its data tree across all servers in the ensemble nodes.

quorum minimum number of legislators required to be present for a note. (How Quorum is be used? Solve the problem of delay to store data across all servers before return to client? Solve the partition problem?Solve the split-brain problem,抽屉原理)

当一个网络中被分隔成两部分以后,不管哪一部分被使用,都会有最新的更新


There are other quorums other than majority quorums


ZooKeeper Session

when a session ends for any reason, the ephemeral nodes created during session disappeared.(能有哪些原因?)

Moving a session to different server if has not heard from its current server for a some time. Moving session to a different server is transparently by ZooKeeper library.

Session offer order guarantee



ZooKeeper Lifecycle

Case: Waiting on CONNECTING During Network Partitions


ZooKeeper Quorums 

1. server need to know each other, each zookeeper server is configured with a list of servers, if quorum is reached, then the service is available.

2. client specify the host:port pair it tries to connect(we can limit the hosts client can reached to achieve simple location based balancing)


Can we enhance third-party framework or application to use ZooKeeper do coordination work?


Implementing a Primitive: Locks with ZooKeeper

To acquire a lock, create a ephemeral znode: /lock

Others watch changes for /lock


Implementation of a Master-Worker Example

Roles

Master / Worker / Client


Master

master相当于一个竞争资源,对应lock recipe,创建一个ephemeral node用来表示master

create ephemeral znode: /master


stat /master true

监听(watch)/master节点


Workers, Tasks, Assignments

persistent

create /workers ""

create /tasks "" 

create /assigns ""


ls /workers true

ls /tasks true

监听 /workers 子节点是否发生改变


The Work Role

create -e /workers/worker1.example.com "worker1.example.com:2224"

此时针对 ls /workers true 的watcher将会接受到通知


create -e /assign/worker1.example.com 

创建子节点接收任务分配

ls /assign/worker1.example.com true


The Client Role

create -s  /tasks/task- "cmd"

created /tasks/task-000000

-s 表明自增


ls /tasks/task-000000 true

监听task完成情况


当task创建完成以后,服务器监听到此事件,就去找当前的 tasks 和 workers 去完成任务分配

ls /tasks

=> [task-000000]

ls /workers

=> [worker1.example.com]

create /assign/worker1.example.com/task-000000 ""


此时worker将会接收到新分配任务的通知,执行任务

当worker完成任务以后,创建一个task的对应status node

/tasks/task-000000/status "done"

此时client会监听到task完成



IMPORTANT: ZooKeeper Internals

ZooKeeper Internals

in Ensemble, One leader handling all requests;  followers receive and vote for updates;observer not participate in decision process, they only learn what have been decided


Requests, Transactions, and Identifiers

Requests读写分离

ZooKeeper server process read requests locally (exists, getData, getChildren) .

ZooKeeper leader process write requests (create, delete, setData).


Question: 如果client和Server A建立了session,发起了一个write request,完成。再向Server A发起了一个read request,并不能保证Server A一定能读到最新的?



Transaction: one state update operation (write request)

check the version number

idempotent: apply transaction multi times get same result

zxid: ZooKeeper transaciton id


Leader Election

leader election notification: server identifier (sid) and most transaction it executes (zxid)

p158


Zab: ZooKeeper Atomic Broadcast protocol



References

<<ZooKeeper>>

http://blog.cloudera.com/blog/2013/02/how-to-use-apache-zookeeper-to-build-distributed-apps-and-why/

http://zookeeper.apache.org/doc/trunk/recipes.html

http://www.ibm.com/developerworks/library/bd-zookeeper/

http://highscalability.com/blog/2008/7/15/zookeeper-a-reliable-scalable-distributed-coordination-syste.html

https://engineering.pinterest.com/blog/zookeeper-resilience-pinterest


kafka

http://kafka.apache.org/documentation.html


paxos算法[ZooKeeper内部实现的算法模型]

http://baike.baidu.com/link?url=GZCf2VymTzeZDfGCRs2QgPpjLm6xJEX5TzvtWEQOULy77yEqO0nc6Gy6JOxJjIaBSPTCqv9E1fEKUx420AyX9q

http://research.microsoft.com/en-us/um/people/lamport/pubs/paxos-simple.pdf

http://www.ux.uis.no/~meling/papers/2013-paxostutorial-opodis.pdf

https://www.youtube.com/watch?v=JEpsBg0AO6o 【非常好的解释,需要翻墙】

https://distributedthoughts.wordpress.com/2013/09/22/understanding-paxos-part-1/

Kafka常用命令收录   本文内容主要来自两个方面:一是网上的分享,二是自研的随手记。日记月累,收录kafka各种命令,会持续更新。   在0.9.0.0之后的Kafka,出现了几个新变动,一个是在Server端增加了GroupCoordinator这个角色,另一个较大的变动是将topic的offset 信息由之前存储在zookeeper上改为存储到一个特殊的topic(__consumer_offsets)中。 立即下载

相关推荐

量化交易新手入门:从零开始搭建你的第一个Python交易策略(附完整代码)

本文为量化交易新手提供从零开始搭建Python双均线策略的完整指南,涵盖环境配置、数据获取、策略实现及风险管理等关键步骤。通过详细的代码示例和实践建议,帮助读者快速掌握量化交易的核心技术,并避免常见陷阱。文章特别强调Python在量化交易中的技术革新优势,适合希望进入金融科技领域的初学者。

weixin_26905487的博客 443

分布式协议与算法(一)Paxos 算法

什么是 Paxos 算法? Paxos 算法是莱斯利·兰伯特于 1990 年提出的一种基于消息传递且具有高度容错特性的共识(consensus)算法。 兰伯特提出的 Paxos 算法包含 2 个部分: 一个是 Basic Paxos 算法,描述的是多节点之间如何就某个值(提案 Value)达成共识; 另一个是 Multi-Paxos 思想,描述的是执行多个 Basic Paxos 实例,就一系列值达成共识。 Paxos 算法在分布式领域具有非常重要的地位,开源分布式锁组件 Google Chubby 的

qq40988670的博客 1115

HA集群 执行 hdfs haadmin -transitionToActive 失败

最近把一个单NameNode集群变更为HA集群,过程中都很顺利,nn1和nn2两个NameNode都显示standby状态,但是把nn1或者nn2切换到active状态时就会报错抛异常。 查看master上namenode启动日志,如下: Incompatible clusterID for journal Storage Directory /home/hadoop-zero/bigdat...

qq_34727158的博客 1763

Kafka常用命令整理

1.前言 2.Broker默认端口号 3.启动Kafka 4.创建Topic 5.列出所有Topic 6.删除Topic 7.查看Topic 8.增加topic的partition数 9.生产消息 10.消费消息 11.查看有哪些消费者Group 12.查看新消费者详情 13.查看Group详情 14.删除Group 15.设置consum...

Kim_Weir的专栏 1600

目前最强的价格行为技术分析AI!大A也能用!还免费!

有球友推荐了一个历史最强的价格行为技术分析AI工具,使用下来确实很惊艳,解决了 很多AI工具黑盒过程,难以回溯的问题,他的决策过程可解释,提供决策树、诊断结果、原始响应、调试信息和未来走势预期。用户能够看到模型为什么选择“做多、做空或不下单”。会检查置信度、入场条件、盈亏比、结构失效和冷却期。最大的优点不是“预测一定准确”,而是把主观的价格行为分析整理成了可重复、可解释、可校验、可持续跟踪的工程化流程。本文记录本项目在 Windows 上的实际部署与启动方法。

木头大左的博客 71

5.7 BGP属-ORIGIN

注意:当去往同一个目的地存在多条不同Origin属性的路由时,在其他条件都相同的情况下,BGP将按如Origin的下顺序优选路由:IGP > EGP > Incomplete。通过以上输出可以看到路由表选择了R3发过来的路由,因为R1的路由的起源为?通过以上输出我们可以看到针对于1.1.1.1这条路由有两条,从R1和R3传过来的起源都属于IGP。(4)把从R1传过来的路由的起源改为incomplete。通过以上输出可以看到,从R1传过来的路由是最优的。(2)在R2上查看1.1.1.1的路由详细信息。

lwljh134的博客 308

分布式协调器ZooKeeper3.4—程序员手册

【ZooKeeper是Apache Hadoop下的开源软件,是一个分布式的协调器,本文来自于Zookeeper的官方网站,地址为:http://zookeeper.apache.org/doc/r3.4.5/zookeeperProgrammers.html】 Programmer'sGuide:Developing Distributed Applications that use Zo

guxch的专栏 5661

【DNN实现二分类模型推理部署(C#)----20240712】

【DNN实现二分类模型推理部署(C#)----20240712】

weixin_44119674的博客 211

zookeeper相关资料

对zookeeper有兴趣的同学可以看看这个apache项目,zookeeper的client   http://curator.apache.org/       这里列举了通过zookeeper和curator可以实现很多case,这个可以重点看一下   http://curator.apache.org/curator-recipes/index.html

xinyu4856的专栏 438

腾讯开源SuperSonic:AI+BI如何重塑数据分析?

SuperSonic是腾讯开源的AI+BI平台,融合Chat BI与Headless BI,为制造企业提供实时数据分析。它通过自然语言交互打破数据壁垒,实现生产、库存、质量、供应链等多环节优化,提升决策效率,其开源生态与扩展性助力企业数字化转型与数据价值挖掘。

数据与算法架构提升之路专栏 4535

2026年全国青少年信息素养大赛复赛真题(算法应用主题赛C++初中组:带解析)(7月4日试卷一)【文末附答案和解析】

2026年全国青少年信息素养大赛复赛真题(算法应用主题赛C++初中组:带解析)(7月4日试卷一)【文末附答案和解析】

王老师青少年编程 1733

ZooKeeper相关资料集锦

1、ZooKeeper相关概念总结 https://github.com/Snailclimb/JavaGuide/blob/master/docs/system-design/framework/ZooKeeper.md 2、ZooKeeper在Windows下的安装和配置 https://blog.youkuaiyun.com/morning99/article/details/4042613...

weixin_30868855的博客 114

YOLO格式数据集【数据增强】终极脚本 | 70+种顶级数据增强方法 | 可带标签增强

YOLO格式数据集【数据增强】终极脚本 | 70+种顶级数据增强方法 | 可带标签增强

Coding... 5499

dubbo+zookeeper相关资料收集

dubbo 开发者指南 + 用户指南 开发者指南: http://dubbo.io/Developer+Guide-zh.htm 用户指南: http://dubbo.io/User+Guide-zh.htm dubbo 项目源码 https://github.com/alibaba/dubbo windows zookeeper 配置 http://www.cnb

naraku0302的专栏 528

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

zookeeper单元测试

curator-test:Contains the TestingServer, the TestingCluster and a few other tools useful for testing. 深坑: curator竟然不是向下兼容的,https://issues.apache.org/jira/browse/CURATOR-428(使用版本) log4j-over-slf4j竟然也不是向下兼容的,扯犊子呢,而且外文文档也是一通瞎扯 [惊恐] [惊恐] [惊恐] 原理: 启动

阿拉斯加大闸蟹的博客 3001

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

zookeeper目录资料

zookeeper目录资料

weixin_44718747的博客 139

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

zookeeper还不错的资料

http://www.cnblogs.com/shanyou/p/3221990.html

shen332401890的专栏 776

Zookeeper学习资源

Zookeeper学习资源收集…

至尊宝 559

Zookeeper实现服务动态ip注册和发现,并能在网络波动后重连(重新注册)

#encoding=utf8 import socket import time from kazoo.client import KazooClient from kazoo.client import EventType, WatchedEvent from kazoo.exceptions import NoNodeError import random class ZKModelWatcher(object): def __init__(self, hosts, model_name,.

alim2012的博客 770

dubbo+zookeeper的分布式部署

1 启动zookeeper   ############################################################# [root@dataNode6 bin]# ./zkServer.sh start [root@dataNode6 bin]# ./zkServer.sh status [root@dataNode6 bin]# ./zkServ

dl0246的博客 2583

Apache zookeeper kafka 开启SASL安全认证(1)

使用kafka-console-producer.sh脚本测试生产者,由于开启安全认证和授权,此时使用console-producer脚本来尝试发送消息,那么消息会发送失败,原因是没有指定合法的认证用户,因此客户端需要做相应的配置,需要创建一个名为producer.conf的配置文件给producer程序使用。Client配置了broker到Zookeeper的连接用户名密码,这里要和前面zookeeper配置中的zk_jaas.conf.conf 中 user_kafka 的账号和密码相同。

2401_84545669的博客 1069

Zookeeper学习笔记

背景介绍 Zookeeper的中文含义为动物管理员,最初是由。。,主要用于分布式系统中配置信息的集中管理;Zookeeper集群通常由奇数个节点组成。节点内数据组织结构为树状结构。 四种节点类型 永久节点 临时节点 永久有序节点 临时有序节点 使用协议 ZAB:Zookeeper Atomic Broadcast, Zookeeper第一次启动时,使用崩溃恢复,原子广播协议; 使用场景 分布式锁 实现原理 Zookeeper集群 其他补充 羊群效应: 参考资料 .

It_BeeCoder的博客 1496

Zookeeper相关问题

1. sh zkCli.sh 启动zookeeper 客户端报错  前些的时候,Zookeeper的安装是成功的,也启动成功,但是今天不知道就怎么了,另外一台装突然就一直启动不起来。   重启之后可以恢复,但是不就之后又报错了。     Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not ...

weixin_37618127的博客 189

Hadoop入门(二):ZooKeeper单机安装

ZooKeeper安装 1下载解压 cd /usr/local/src wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz tar zxvf zookeeper-3.4.5.tar.gz 2配置 cd zookeeper-3.4.5 cp conf/

西代零零发 3477
上一篇: java8 Stream和Lisp对比
下一篇: <<Big Data: Principles and Best Practices of Scalable Realtime Data Systems>>读书笔记
kiwi小白
博客等级 码龄14年 153粉丝 154原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值