由于平台马上要引入zookeeper+dubbo,为了解决zookeeper单个实例运行的风险,需要做个集群。

1,先说配置:zoo.cfg十分简单,分两种情况:

一种是在一台机器采用不同的端口配置多个服务;另一种是在多台机器上每个配一个服务,这样的安全系数会大很多。

单机版:

# 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=/Users/xxxxxx/zookeeper/zookeeper-3.3.6/server1/data
#不同节点不同端口:2081,2182,2183
clientPort=2181
server.1=localhost:2888:3888
server.2=localhost:2889:3889
server.3=localhost:2890:3890

多机版:

clientPort=2181
server.1=10.2.38.5:2888:3888
server.2=10.2.38.6:2888:3888
server.3=10.2.38.7:2888:3888

2,在各自data下面写入myid文件,内容为节点的序号,如1:

echo '1' > myid

3,依次启动服务即可:

sh zkServer.sh start

 

相关文章:

  • 2021-05-28
  • 2021-11-24
  • 2022-01-01
  • 2022-01-01
  • 2021-05-20
  • 2021-05-22
猜你喜欢
  • 2022-03-07
  • 2022-12-23
  • 2021-08-29
  • 2021-12-06
  • 2021-07-05
  • 2021-11-30
  • 2021-09-24
相关资源
相似解决方案