配置三个config
dataDir=/usr/local/install/zookeeper/data/data1
dataLogDir=/usr/local/install/zookeeper/log/log1
clientPort=2181
server.1=localhost:2287:3387
server.2=localhost:2288:3388
server.3=localhost:2289:3389
dataDir=/usr/local/install/zookeeper/data/data2
dataLogDir=/usr/local/install/zookeeper/log/log2
clientPort=2182
server.1=localhost:2287:3387
server.2=localhost:2288:3388
server.3=localhost:2289:3389
dataDir=/usr/local/install/zookeeper/data/data3
dataLogDir=/usr/local/install/zookeeper/log/log3
clientPort=2183
server.1=localhost:2287:3387
server.2=localhost:2288:3388
server.3=localhost:2289:3389
三个data配置文件中myid 分别写入1、2、3
启动脚本:
/usr/local/install/zookeeper/bin/zkServer.sh start /usr/local/install/zookeeper/conf/config/zoo1.cfg
/usr/local/install/zookeeper/bin/zkServer.sh start /usr/local/install/zookeeper/conf/config/zoo2.cfg
/usr/local/install/zookeeper/bin/zkServer.sh start /usr/local/install/zookeeper/conf/config/zoo3.cfg