红色标记位置是需要修改的配置
1 # The number of milliseconds of each tick 2 tickTime=2000 3 # The number of ticks that the initial 4 # synchronization phase can take 5 initLimit=10 6 # The number of ticks that can pass between 7 # sending a request and getting an acknowledgement 8 syncLimit=5 9 # the directory where the snapshot is stored. 10 # do not use /tmp for storage, /tmp here is just 11 # example sakes. 12 dataDir=/usr/local/zookeeper/data 13 # the port at which the clients will connect 14 clientPort=2181 15 # the maximum number of client connections. 16 # increase this if you need to handle more clients 17 #maxClientCnxns=60 18 # 19 # Be sure to read the maintenance section of the 20 # administrator guide before turning on autopurge. 21 # 22 # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance 23 # 24 # The number of snapshots to retain in dataDir 25 #autopurge.snapRetainCount=3 26 # Purge task interval in hours 27 # Set to "0" to disable auto purge feature 28 #autopurge.purgeInterval=1 29 30 dataLogDir=/usr/local/zookeeper/logs 31 32 server.1=192.168.3.201:2888:3888 33 34 server.2=192.168.3.202:2888:3888 35 36 server.3=192.168.3.203:2888:3888
server.1 的myid内容为1
192.168.3.201
echo "1">> /usr/local/zookeeper/data/myid
server.2的myid内容为2
192.168.3.202
echo "2">> /usr/local/zookeeper/data/myid
server.3的myid为 3
192.168.3.203
echo "3">> /usr/local/zookeeper/data/myid
转载于:https://www.cnblogs.com/Matchman/p/7357763.html
相关资源:JAVA上百实例源码以及开源项目