参考官方文档:http://zookeeper.apache.org/doc/r3.4.6/zookeeperStarted.html
1、下载zookeeper-3.4.6 2、解压到安装目录 3、编辑配置文件{ZOOKEEPER_HOME/conf/zoo.cfg} dataDir:指定内存数据库的路径 server.x中序号是为了区分zookeeper集群,当zookeeper集群启动, 会在myid文件找到对应的序号。
[chb@TEST conf]$ cat zoo.cfg tickTime=2000 dataDir=/usr/local/zookeeper-3.4.6/zookeeper clientPort=2181 initLimit=5 syncLimit=2 server.1=TEST:2888:3888 server.2=TEST1:2888:3888 server.3=TEST2:2888:3888 [chb@TEST conf]$tickTime the basic time unit in milliseconds used by ZooKeeper. It is used to do heartbeats and the minimum session timeout will be twice dataDir the location to store the in-memory database snapshots and, unless specified otherwise, the transaction log of updates to the database. clientPort the port to listen for client connection
添加如下:
#zookeeper export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.6 export PATH=$PATH:$ZOOKEEPER_HOME/bin使/etc/profile有效:
source /etc/profile确保没有错误出现
修改zookeeper配置如下:
