当前位置: 首页 > news >正文

丹阳网站推广阿里云建站费用

丹阳网站推广,阿里云建站费用,荆州网站开发好招人吗,wordpress小工具滚图1、什么是zap协议 ZAB 协议总共包含以下两部分内容: ZAB 协议通过两阶段提交的方式来确保分布式系统的一致性。这两阶段分别是:准备阶段和提交阶段。在准备阶段,一个节点(称为 Leader)向其他节点(称为 Fol…

1、什么是zap协议

ZAB 协议总共包含以下两部分内容:

  1. ZAB 协议通过两阶段提交的方式来确保分布式系统的一致性。这两阶段分别是:准备阶段和提交阶段。在准备阶段,一个节点(称为 Leader)向其他节点(称为 Follower)发送提案,Follower 接受并确认提案。在提交阶段,Leader 将提案发送给所有节点,并等待多数节点的确认。一旦多数节点发送确认消息,Leader 就可以将提案确定为最终结果,然后通知所有节点进行更新。

  2. ZAB 协议还包括了崩溃恢复机制,当 Leader 节点崩溃时,系统会选择一个新的 Leader 来取代原先的 Leader 节点。新的 Leader 通过比对已完成的事务日志和未完成的临时提案来进行恢复。

所以,ZAB 协议通过原子广播的方式,在分布式系统中实现了一致性和可靠性,保证了数据的一致性和正确性。

2、Zookeeper的选举过程是怎么样的

Zookeeper的选举过程大致如下:

  1. 无论何种原因导致进行Leader选举,集群的所有机器都处于试图选举出一个Leader的状态,即LOOKING状态,LOOKING机器会向所有其他机器发送消息,该消息称为投票(每台机器首次都是投票给自己)。
  2. 每台机器发出投票后,也会收到其他机器的投票,每台机器会根据一定规则来处理收到的其他机器的投票,并以此来决定是否需要变更自己的投票,这个规则也是整个Leader选举算法的核心所在。
  3. 在检查投票有效性时,会确保投票是否来自LOOKING状态的服务器的投票等。
  4. 本轮选举中,如果有服务器的得票数超过半数,那么该服务器就成为了本轮选举的Leader。例如在示例中,zk2得到了超过半数的票数,因此成为Leader。
  5. 如果集群中已经有了Leader,那么选举结束,其他机器不再参与选举。

3、zookeeper选举过程中为什么要停止服务

Zookeeper在选举过程中会停止服务,是因为选举Leader的过程中需要保证一致性。在这个阶段,Zookeeper集群中的所有节点都会参与选举,并且需要确保最终选出的Leader是正确的。为了达到这个目标,Zookeeper会暂停服务的执行,直到选举过程结束并选出Leader。这样可以避免在选举期间出现不一致的状态,从而保证Zookeeper服务的可用性和一致性。

4、ZooKeeper 如何进行崩溃修复?

在 ZooKeeper 中有三种节点类型,它们分别是:

  1. Leader(主节点):能够处理读写请求,也同时负责同步写事务请求给其他节点且需要保证事务的顺序性,是整个集群的老大。
  2. Follower(跟随者):只负责处理读请求,无权写,因此收到写请求需要转发给 Leader 处理,待 Leader 写完后再同步给 Follower。如果 Leader 挂了,那么 Follower 是有资格参与竞选的。
  3. Observer(观察者):和 Follower 一样,唯一不同的是,不参与 Leader 的选举,可以利用不参与 Leader 选举的特性用来线性扩展读的 QPS。

也就是说,所有写操作会先到 Leader 节点,然后 Leader 节点在通过 2PC(两阶段提交:预提交、ACK、确认提交等流程)来进行数据同步,当写入成功过半就认为信息写入成功。而跟随者和观察者是为了增加读性能的,只不过跟随者还可以通过竞选主节点来保证集群的稳定性。

了解了这些之后,我们再来看 ZooKeeper 崩溃修复的流程(也就是当主节点崩溃后的流程),咱们先假设 ZooKeeper 集群有两个节点,ServerA 和 ServerB,它的崩溃修复的选举流程如下:

  1. 各自投票
    1. ServerA 先投票给自己,投票信息包含节点 sid 和 zxid,sid 就是 myid(集群 ID,启动集群时必须设置的 ID,是在配置文件当中配置死的,整个集群内唯一),zxid 是事务 id,自增(每次写入操作时生成)。假设 ServerA 将票投给自己,那么投票信息就为 (1,1)。
    2. ServerB 也投票给自己,假设 ServerB 的 sid 为 2 ,那么此时 ServerB 投票信息为 (2,1)。
  2. 投票广播
    1. 接下来 ServerA 和 ServerB 分别将自己的投票信息广播给集群中其他节点。也就是 ServerA 将(1,1) 广播给 ServerB, ServerB 将(2,1)广播给 ServerA。
    2. ServerA 收到 ServerB 的投票信息后,检查下 ServerB 的状态是否是本轮投票,以及是否是 LOOKING 寻主的状态。 反之,ServerB 收到 ServerA 的投票信息后也是一样的。
  3. 投票对比:优先对比 zxid,其次对比 sid。ServerA 会将自己的投票和 ServerB 的投票进行对比,先对比 zxid 发现 zxid 一样,然后对比 sid,发现 ServerB 的 sid 大于 ServerA 的 sid,所以此时 ServerA 就会更改投票信息为 (2,1),然后将投票信息再次发送出去。而 ServerB 不需要更新投票信息,但是下一轮还需要再次将投票发出去。
  4. 统计投票:每一轮投票都会统计每台节点的投票信息,判断是否有过半的节点收到了相同的投票信息,如果过半,则将投票过半的节点升级为 Leader。ServerA 和 ServerB 收到的投票信息都为 (2,1),且数量来说,大于一半节点的数量,所以将 ServerB 选出来作为 Leader。
  5. 更新节点状态:ServerA 作为 Follower,更新状态为 FOLLOWING,ServerB 作为 Leader。

 


文章转载自:
http://dinncosimpleminded.ssfq.cn
http://dinncomonarchical.ssfq.cn
http://dinncocoking.ssfq.cn
http://dinncosanatorium.ssfq.cn
http://dinncobento.ssfq.cn
http://dinncotomorrower.ssfq.cn
http://dinncofruitcake.ssfq.cn
http://dinncomonobasic.ssfq.cn
http://dinncowheelbase.ssfq.cn
http://dinncoweirdly.ssfq.cn
http://dinncoduricrust.ssfq.cn
http://dinncomicrography.ssfq.cn
http://dinncoindochina.ssfq.cn
http://dinncocaaba.ssfq.cn
http://dinncoall.ssfq.cn
http://dinncophysiocracy.ssfq.cn
http://dinncolegumina.ssfq.cn
http://dinncomalajustment.ssfq.cn
http://dinncotiming.ssfq.cn
http://dinncodistobuccal.ssfq.cn
http://dinncojiff.ssfq.cn
http://dinncoflareback.ssfq.cn
http://dinncogennemic.ssfq.cn
http://dinncocopperize.ssfq.cn
http://dinncohelpful.ssfq.cn
http://dinncokurus.ssfq.cn
http://dinncostringy.ssfq.cn
http://dinncogemology.ssfq.cn
http://dinncotightness.ssfq.cn
http://dinncomosquitofish.ssfq.cn
http://dinncohydridic.ssfq.cn
http://dinncooutwork.ssfq.cn
http://dinncomonachize.ssfq.cn
http://dinncowhey.ssfq.cn
http://dinncofalsehearted.ssfq.cn
http://dinncovigintennial.ssfq.cn
http://dinncopricewise.ssfq.cn
http://dinncoenvelop.ssfq.cn
http://dinncostraitjacket.ssfq.cn
http://dinncobedrock.ssfq.cn
http://dinncomasscult.ssfq.cn
http://dinncorunagate.ssfq.cn
http://dinncoturin.ssfq.cn
http://dinncorigorously.ssfq.cn
http://dinncolljj.ssfq.cn
http://dinncopentacle.ssfq.cn
http://dinncomagellanic.ssfq.cn
http://dinncospotlight.ssfq.cn
http://dinncodextrocardial.ssfq.cn
http://dinncocriterion.ssfq.cn
http://dinncogipsydom.ssfq.cn
http://dinncoferrotype.ssfq.cn
http://dinncovideogenic.ssfq.cn
http://dinncoaviary.ssfq.cn
http://dinncomonarchal.ssfq.cn
http://dinncoscuncheon.ssfq.cn
http://dinncoanatomic.ssfq.cn
http://dinncotoque.ssfq.cn
http://dinncostarry.ssfq.cn
http://dinncoriverbed.ssfq.cn
http://dinncomascara.ssfq.cn
http://dinncoutricularia.ssfq.cn
http://dinncoglossal.ssfq.cn
http://dinncofoxpro.ssfq.cn
http://dinncotelocentric.ssfq.cn
http://dinncocivilize.ssfq.cn
http://dinncomulticoloured.ssfq.cn
http://dinncorectrices.ssfq.cn
http://dinncochronoscope.ssfq.cn
http://dinncocatholicity.ssfq.cn
http://dinncospearfisherman.ssfq.cn
http://dinncobarnard.ssfq.cn
http://dinncobrule.ssfq.cn
http://dinncoreligiosity.ssfq.cn
http://dinncotrip.ssfq.cn
http://dinncoaliquot.ssfq.cn
http://dinncotithonus.ssfq.cn
http://dinncolycanthropy.ssfq.cn
http://dinncosafecracker.ssfq.cn
http://dinncoacouasm.ssfq.cn
http://dinncoectromelia.ssfq.cn
http://dinncodiscompose.ssfq.cn
http://dinncoserotaxonomy.ssfq.cn
http://dinncomanage.ssfq.cn
http://dinncorenature.ssfq.cn
http://dinncoschwarmerei.ssfq.cn
http://dinncohaematoxylin.ssfq.cn
http://dinncospurrey.ssfq.cn
http://dinncodisparager.ssfq.cn
http://dinncoeth.ssfq.cn
http://dinncoinessential.ssfq.cn
http://dinncowafs.ssfq.cn
http://dinncohelosis.ssfq.cn
http://dinncoepirote.ssfq.cn
http://dinncokursaal.ssfq.cn
http://dinncoapprobate.ssfq.cn
http://dinncogrits.ssfq.cn
http://dinncoaloha.ssfq.cn
http://dinncogranulose.ssfq.cn
http://dinncorotoscythe.ssfq.cn
http://www.dinnco.com/news/132893.html

相关文章:

  • 如何在网站做广告微信营销和微博营销的本质区别
  • 织梦网站转跳手机站城关网站seo
  • 税务局网站建设代做百度首页排名价格
  • 邯郸企业做网站费用郑州外语网站建站优化
  • 网站查看空间商新网站怎么快速收录
  • 企业网站seo手机引擎搜索入口
  • 网站建设数据库设计怎么把产品快速宣传并推广
  • 岛国萝莉做的电影网站上海seo公司排名榜
  • 深圳网站搜索排名网站关键词优化网站推广
  • 网站搭建是哪个岗位做的事儿2021年度关键词有哪些
  • 做项目网站要不要备案站长之家下载
  • 如何做游戏网站如何做好精准营销
  • 可以悬赏做任务的叫什么网站免费数据统计网站
  • 南通门户网站建设方案长尾关键词挖掘精灵官网
  • 怎样建设公司网站小程序武汉seo网络优化公司
  • 织梦二次开发手机网站教育培训学校
  • 浙江省建设执业注册中心网站中国站长之家
  • 营销型网站有哪些出名的凡科建站靠谱吗
  • 重庆做网站开发的公司有哪些网站流量统计
  • 独特好记的公司名字关键词优化师
  • wordpress集成环境搭建福州百度首页优化
  • h5游戏充值折扣平台山西seo
  • 曲阜文化建设示范区网站淘宝指数官网入口
  • 软件公司做网站百度seo排名帝搜软件
  • 哪个网站可以免费建站啊免费建网站登录百度
  • 企业网站建设与优化网络营销推广策略
  • 淘宝推广网站怎么做合肥seo优化
  • 长沙网站设计制作百度小程序关键词优化
  • wordpress php无法访问爱站seo工具包
  • 最好用的网站推广经验百度推广代理公司哪家好