java - 无法让 ZooKeeper 集群工作,选举永远不会发生

标签 java linux configuration hadoop apache-zookeeper

这是我第一次尝试 ZooKeeper,虽然我可以轻松地将其设置为在单台机器上运行,但让它在两台机器的集群中运行根本行不通。我认为我的配置可能有问题,但看起来我找不到它。

Here are the logs for server 1

Here are the logs for server 2

我的两台服务器的配置如下:

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/var/lib/zookeeper
# the port at which the clients will connect
clientPort=2181
server.1=redis1:2888:3888
server.2=redis2:2888:3888

对可能出现的问题有什么想法吗?

我在运行 OpenJDK 7 的 Ubuntu Linux 机器上运行 ZooKeeper 3.4.5。尝试在 OpenJDK 6 上运行,但仍然遇到同样的问题。

最佳答案

问题是我有偶数个节点,您需要奇数个节点才能进行选举(显然)。应该更新文档以涵盖这一点,因为基本示例仅显示了 2 个正在配置的服务器。

关于java - 无法让 ZooKeeper 集群工作,选举永远不会发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13863756/

相关文章:

java - 如何一次打印 x 行

python - 在python上查找mac地址

c++ - 函数返回时 Linux c++ system() 调用崩溃

java - 无法提取响应 : no suitable HttpMessageConverter with jaxb2marshaller

xml - SMTP Appender - log4net 问题

java - 如何在共享首选项中保存 float 组?

java - 一次读取两行 CSV (Java)

Java客户端-服务器问题

java - 由 : There is no result type defined for type 'chain' mapped with name 'success' 引起

linux - 混淆使用 52 个字符设置 i2p base32