在所有机器上安装完zookeeper之后, 开始进行集群的搭建
1. 修改 ../zookeeper/conf/zoo.cfg 文件
tickTime=2000 dataDir=/usr/local/zookeeper/data clientPort=2181 initLimit=5 syncLimit=2 server.1=IP1:2888:3888 server.2=IP2:2888:3888 server.3=IP3:2888:3888
2. 在所有的机器上创建目录:
/usr/local/zookeeper/data
3. 分别在
IP1的机器上的 /usr/local/zookeeper/data 目录中创建myid文件, 内容为 1: echo 1 > myid
IP2的机器上的 /usr/local/zookeeper/data 目录中创建myid文件, 内容为 2: echo 2 > myid
IP3的机器上的 /usr/local/zookeeper/data 目录中创建myid文件, 内容为 3: echo 3 > myid
......,
必须与zoo.cfg配置文件的server配置一一对应,
4. 启动所有的zk即可
./zookeeper/bin/zkServer.sh start