一、连接多个服务器,用逗号隔开

  

  1. 如果在连接时候zk服务器宕机
  2. To create a client session the application code must provide a connection string containing a comma separated list of host:port pairs, each corresponding to a ZooKeeper server (e.g.
  3. "127.0.0.1:4545" or "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002"). The ZooKeeper client library will pick an arbitrary server and try to connect to it. If this connection fails, or if the client
  4. becomes disconnected from the server for any reason, the client will automatically try the next server in the list, until a connection is (re-)established.
  5. 创建一个client session 应用代码必须提供一个连接字符串包含一个逗号分隔的主机:端口 列表,
  6. 每个对应到一个ZooKeeper server (e.g.
  7. "127.0.0.1:4545" or "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002").
  8. ZooKeeper 客户端库 会选择一个任意的server 和尝试连接到它。
  9. 如果这个连接失败,或者 如果客户端变的不能连接,客户端会自动 尝试下一个server 在列表里,知道一个连接重新创建。
  10. 如果已经连接之后服务器宕机
  11. SessionMovedException. There is an internal exception that is generally not seen by clients called the SessionMovedException. This exception occurs because a request was received on a connection
  12. for a session which has been reestablished on a different server. The normal cause of this error is a client that sends a request to a server, but the network packet gets delayed, so the client
  13. times out and connects to a new server. When the delayed packet arrives at the first server, the old server detects that the session has moved, and closes the client connection. Clients normally do
  14. not see this error since they do not read from those old connections. (Old connections are usually closed.) One situation in which this condition can be seen is when two clients try to reestablish
  15. the same connection using a saved session id and password. One of the clients will reestablish the connection and the second client will be disconnected (causing the pair to attempt to re-establish
  16. its connection/session indefinitely).
  17. SessionMovedException. 有一个内部的异常,那是通常不被客户端请求SessionMovedException 看到。
  18. 这个exception 因为 一个请求被接收在一个连接对于一个会话 精被重新建立到一个不同的zk server.
  19. 这个错误的通常情况是一个客户端发送一个请求到一个服务器,
  20. 但是网络包延时了,因此客户端超时 ,连接到一个新的服务器.当延迟的packet 到达第一个server,
  21. old server 检测倒 session 已经移动了,关闭客户端连接。
  22. 客户端通常不会看到这个错误 因为它们不会从老的连接读取(老的连接通常是被关闭的)
  23. 一种情况是这个状况可以被看到当 2个客户端尝试重建建立相同的连接使用一个保存的会话id和密码。

参考链接:http://blog.csdn.net/zhaoyangjian724/article/details/52218172  

zookeeper 故障重连机制的更多相关文章

  1. zk 节点故障 重连机制

    <pre name="code" class="html">如果在连接时候zk服务器宕机 To create a client session th ...

  2. Zookeeper 重连机制

    Zookeeper 重连机制 public class ZKConnectSessionWatcher implements Watcher { public final static String ...

  3. ActiveMQ的断线重连机制

    断线重连机制是ActiveMQ的高可用性具体体现之一.ActiveMQ提供failover机制去实现断线重连的高可用性,可以使得连接断开之后,不断的重试连接到一个或多个brokerURL. 默认情况下 ...

  4. 正确理解IM长连接的心跳及重连机制,并动手实现(有完整IM源码)

    1.引言 说道“心跳”这个词大家都不陌生,当然不是指男女之间的心跳,而是和长连接相关的.顾名思义就是证明是否还活着的依据. 什么场景下需要心跳呢?目前我们接触到的大多是一些基于长连接的应用需要心跳来“ ...

  5. 详细解析kafka之 kafka消费者组与重平衡机制

    消费组组(Consumer group)可以说是kafka很有亮点的一个设计.传统的消息引擎处理模型主要有两种,队列模型,和发布-订阅模型. 队列模型:早期消息处理引擎就是按照队列模型设计的,所谓队列 ...

  6. Dubbo超时和重连机制

    dubbo启动时默认有重试机制和超时机制.超时机制的规则是如果在一定的时间内,provider没有返回,则认为本次调用失败,重试机制在出现调用失败时,会再次调用.如果在配置的调用次数内都失败,则认为此 ...

  7. testng增加失败重跑机制

    注: 以下内容引自 http://www.yeetrack.com/?p=1015 testng增加失败重跑机制 Posted on 2014 年 10 月 31 日 使用Testng框架搭建自动测试 ...

  8. Netty 之 Netty生产级的心跳和重连机制

    https://blog.csdn.net/z69183787/article/details/52625095 最近工作比较忙,但闲暇之余还是看了阿里的冯家春(fengjiachun)的github ...

  9. 基于netty实现的长连接,心跳机制及重连机制

    技术:maven3.0.5 + netty4.1.33 + jdk1.8   概述 Netty是由JBOSS提供的一个java开源框架.Netty提供异步的.事件驱动的网络应用程序框架和工具,用以快速 ...

随机推荐

  1. memcached SASLAUTH 启动

    1.环境描述: Linux 服务器,memcached1.4.5 登录linux的用户名tuxedo,密码tuxedo 2.启动memcached sasl认证 p.p1 { margin: 0.0p ...

  2. 。。。学习CSS3的第一个属性border-radius。。。

    学习border-radius,感觉这个文档写的很不错: http://blog.sina.com.cn/s/blog_61671b520101gelr.html

  3. 计算ScrollView的当前页面

    //每页宽度 CGFloat pageWidth = sender.frame.size.width; //根据当前的坐标与页宽计算当前页码 int currentPage = floor((send ...

  4. 3D数学的实际应用

    以前自己在学习三维程序开发时并没有在意3D数学在程序中的重要作用,但在实际工作中逐渐发现:自己忽视了3D数学的作用,我们实际开发工作总要求模型准确的变换,而不是强调渲染有多炫,那是游戏,如果是仿真程序 ...

  5. Android数字签名

    描述你对Android数字签名的理解? 数字签名就是为程序打上一个标记来作为自己的标识,是Android系统要求的,若一个Android程序没有经过数字签名,没办法安装到系统: 签名也是对apk的一种 ...

  6. iOS 图片的按照比例拉伸

    // 这是一个UIImage 的分类 (  UIImage+Extension.h   ) UIImage+Extension.h #import <UIKit/UIKit.h> @int ...

  7. 捷波朗 jabra BT3030 蓝牙耳机

    蓝牙版本V2.0 通话时间 8小时 按键说明:轻敲 快按轻敲两下 在1.5秒内快速按两下按 大约 1秒钟按住 大约 4秒钟 充电提示绿灯闪亮 正在充电持续绿灯 已完全充满电 检查电量按 音量上调(+) ...

  8. Linux下的Hello world

    总算正式开始学习Linux了. 先从Hello world入手. 1. 查看当前目录 lenovo@ubuntu:~$ pwd /home/lenovo 2. 新建test目录 lenovo@ubun ...

  9. 前端基础之 url src href

    在实际使用中有时候会犯糊涂,因此来认真了解下这三者的具体用法. url 是资源定位器,是一种数据类型,和长度,颜色等属性并列.在写img的路径的时,如<img src="http:// ...

  10. C# Winform中DataGridView绑定后DataGridViewCheckBoxColumn无法显示的问题

    在控件DataGridView绑定数据源后,发现DataGridViewCheckBoxColumn不能显示当前的check值.经过一番努力,现将完整代码奉献出来,仅供参考. 错误代码: /*禁止自动 ...