zk创建集群

在单机环境下和创建集群。

需要注意的点:

  • 配置数据文件myid 1/2/3 对应server.1/2/3
  • 通过./zkCli.sh -server [ip]:[port]  检测集群是否创建成功

 

在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.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataLogDir=/usr/local/zookeeper01/logs      ############需要重新设置下,日志存放的地方
dataDir=/usr/local/zookeeper01/data         ############需要重新设置下,数据存放的地方
# the port at which the clients will connect
clientPort=2183
# 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
server.1=localhost:2287:3387
server.2=localhost:2288:3388
server.3=localhost:2289:3389

 

 

 

但是注意,这个配置文件上面的   dataDir= /usr/local/zookeeper01/data 

然后我们到dataDir对应的目录去创建一个myid的文件  内容是1

其他两个依次类推。

然后重启zkServer.sh restart    

 

posted @ 2018-08-19 23:47  发疯的man  阅读(374)  评论(0)    收藏  举报