java - Zookeeper cfg 文件 - 为什么有多个端口?

标签 java hadoop distributed distributed-computing apache-zookeeper

nano conf/zoo.cfg  

tickTime=2000  
dataDir=/var/lib/zookeeper  
clientPort=2181  
initLimit=5  
syncLimit=2  
server.1=10.0.0.2:2888:3888  
server.2=10.0.0.3:2888:3888  
server.3=10.0.0.4:2888:3888  

我试图理解这个 cfg 文件。 clientPort 用于传入通信,对吗?但是为什么还有两个这样的端口:server.1=10.0.0.2:2888:3888

最佳答案

The entries of the form server.X list the servers that make up the ZooKeeper service. When the server starts up, it knows which server it is by looking for the file myid in the data directory. That file has the contains the server number, in ASCII.

Finally, note the two port numbers after each server name: " 2888" and "3888". Peers use the former port to connect to other peers. Such a connection is necessary so that peers can communicate, for example, to agree upon the order of updates. More specifically, a ZooKeeper server uses this port to connect followers to the leader. When a new leader arises, a follower opens a TCP connection to the leader using this port. Because the default leader election also uses TCP, we currently require another port for leader election. This is the second port in the server entry.

引用:- http://zookeeper.apache.org/doc/r3.1.2/zookeeperStarted.html

关于java - Zookeeper cfg 文件 - 为什么有多个端口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32642370/

相关文章:

hadoop - 无法在oozie的HDFS中创建sharelib

c++ - 在 Linux 容器内运行 C++ 程序(包含 TCP IP 代码)。

java - 如何在 Java 中执行字符串差异?

java - 覆盖hibernate子类中的主键

hadoop - 有没有办法将节点添加到正在运行的 Hadoop 集群?

hadoop - EMR上的Snappy not available错误

networking - Raft 如何处理长时间的网络分区?

erlang - Erlang 是专为在单个多核机器上运行而设计的,还是可以分配进程?

java - 正则表达式——匹配 ' but not ' '

Java JPA : Performant check if Entity is already in DB