0

./zkServer.sh start
启动zookeeper后,用ps看进程号是4377
然后

$ netstat -nlp|grep 4377
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6 0 0 :::2181 :::* LISTEN 4377/java
tcp6 0 0 :::42860 :::* LISTEN 4377/java

发现监听两个端口
怎么回事?

1个回答

0

一个是提供服务的端口,供客户端连接
一个是集群时leader选举的端口,在选举leader时,使用这个端口进行相互通讯
例如

server.1=192.168.1.101:62888:63888
server.2=192.168.1.102:62888:63888
server.2=192.168.1.103:62888:63888

撰写答案