无法在复制模式下设置zookeeper

发布于 2024-12-10 09:15:18 字数 867 浏览 0 评论 0原文

我正在尝试在具有 3 个服务器的复制节点中设置 Zookeeper。

我的配置文件是这样的

tickTime=2000 
dataDir=/var/lib/zookeeper/ 
clientPort=2181
initLimit=5
syncLimit=2
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888

我收到以下异常

QuorumPeer:/0:0:0:0:0:0:0:0:2181:FastLeaderElection@642] - Adding vote 

2009-09-23 15:30:28,099 - WARN  [WorkerSender Thread:QuorumCnxManager@336] - 
Cannot open channel to 3 at election address zoo1/172.21.31.159:3888 
java.net.ConnectException: Connection refused at sun.nio.ch.Net.connect(Native Method)> at 
sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507) 
at java.nio.channels.SocketChannel.open(SocketChannel.java:146) 
at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:

所有端口都打开并且 ssh、telnet 也正常工作。

谢谢

I am trying to set up zookeeper in replicated node with 3 server.

my config file is like this

tickTime=2000 
dataDir=/var/lib/zookeeper/ 
clientPort=2181
initLimit=5
syncLimit=2
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888

I am getting following exception

QuorumPeer:/0:0:0:0:0:0:0:0:2181:FastLeaderElection@642] - Adding vote 

2009-09-23 15:30:28,099 - WARN  [WorkerSender Thread:QuorumCnxManager@336] - 
Cannot open channel to 3 at election address zoo1/172.21.31.159:3888 
java.net.ConnectException: Connection refused at sun.nio.ch.Net.connect(Native Method)> at 
sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507) 
at java.nio.channels.SocketChannel.open(SocketChannel.java:146) 
at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:

All ports are open and ssh, telnet are also working.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

提笔落墨 2024-12-17 09:15:18

这是一个快速清单:

  • 您有 /var/lib/zookeeper/myid 文件吗?
  • 该文件中定义的 id 是否与配置中定义的计算机名称/IP 同步(zoo1 具有 id 1 等...)?

Here is a quick checklist:

  • Do you have a /var/lib/zookeeper/myid file?
  • Are ids defined in that file in sync with machine names/IPs defined in config (zoo1 having id 1, etc...)?
天煞孤星 2024-12-17 09:15:18

不知道为什么,但我必须在每个服务器的 Zookeeper 配置中使用 0.0.0.0 作为主机名。

即:

服务器 1

myid

1

zoo.cfg

server.1=0.0.0.0:2888:3888
server.2=X.X.X.2:2888:3888
server.3=X.X.X.3:2888:3888

服务器 2

myid

2

zoo.cfg

server.1=X.X.X.1:2888:3888
server.2=0.0.0.0:2888:3888
server.3=X.X.X.3:2888:3888

服务器 3

myid

3

zoo.cfg

server.1=X.X.X.1:2888:3888
server.2=X.X.X.2:2888:3888
server.3=0.0.0.0:2888:3888

Not sure why but I had to use 0.0.0.0 as a host name in Zookeeper config for a each of the servers.

I.e:

Server 1:

myid

1

zoo.cfg

server.1=0.0.0.0:2888:3888
server.2=X.X.X.2:2888:3888
server.3=X.X.X.3:2888:3888

Server 2:

myid

2

zoo.cfg

server.1=X.X.X.1:2888:3888
server.2=0.0.0.0:2888:3888
server.3=X.X.X.3:2888:3888

Server 3:

myid

3

zoo.cfg

server.1=X.X.X.1:2888:3888
server.2=X.X.X.2:2888:3888
server.3=0.0.0.0:2888:3888
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文