首先是/etc/hosts文件,作为集群必须把每台的IP以及别名识别都写入hosts
输入:vi /etc/hosts
然后每台在network上修改自己的别名,以保证其他台linux可以识别到
输入:vi /etc/sysconfig/network
修改如下:
最后在每台的zookeeper/conf/zoo.cfg文件,
输入vi zookeeper/conf/zoo.cfg
修改如下:
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=5
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=2
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/home/yewenbao/zookeeper-3.4.5
dataLogDir=/home/yewenbao/zookeeper-3.4.5/logs
# the port at which the clients will connect
clientPort=2181
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=host1:2888:3888
server.2=host2:2888:3888
server.3=host3:2888:3888
~
~
~
~
~
~
~
~
"zoo.cfg" 29L, 945C
为了保证可以使用,最后reboot重启一下