# 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.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/apache-zookeeper/data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# 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
複製代碼
2181
爲監聽客戶端鏈接端口號 Mode
表示爲單節點配置html
首先分別準備三臺機器ip分別爲apache
機器IP | zk端口號 |
---|---|
192.168.0.1 | 2181 |
192.168.0.2 | 2181 |
192.168.0.3 | 2181 |
每臺機器分別zk目錄的data目錄建立myid文件,內容分別爲1,2,3, 且配置文件均爲以下內容bash
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/usr/local/apache-zookeeper/data
clientPort=2181
server.1=192.168.0.1:2888:3888
server.2=192.168.0.2:2888:3888
server.3=192.168.0.3:2888:3888
複製代碼
若所有啓動後,查看狀態爲未成功,則嘗試關閉防火牆ide
ufw disalbe
複製代碼