前提:已经配置了zookeeper单机
1、复制三份解压缩后的zookeeper
进入/usr/local目录
cp –rf zookeeper zookeeper1
cp –rf zookeeper zookeeper2
cp –rf zookeeper zookeeper3
2、进入cd /usr/local/zookeeper1/zookeeper-3.4.14/文件目录下,在配置目录中修改数据存储目录与日志目录
mkdir data
rm –rf dataDir dataLogDir
进入文件夹,创建myid文件,写入1
echo 1 >> myid
3、修改zookeeper1/2/3的zoo.cfg文件
vim /usr/local/zookeeper1/zookeeper-3.4.14/conf/zoo.cfg
dataDir=/usr/local/zookeeper1/zookeeper-3.4.14/ data
clientPort=2182
quorumListenOnAllIPs=true
server.1=localhost:2882:3882
server.2=localhost:2883:3883
server.3=localhost:2884:3884
vim /usr/local/zookeeper2/zookeeper-3.4.14/conf/zoo.cfg
dataDir=/usr/local/zookeeper2/zookeeper-3.4.14/ data
clientPort=2183
quorumListenOnAllIPs=true
server.1=localhost:2882:3882
server.2=localhost:2883:3883
server.3=localhost:2884:3884
vim /usr/local/zookeeper3/zookeeper-3.4.14/conf/zoo.cfg
dataDir=/usr/local/zookeeper3/zookeeper-3.4.14/ data
clientPort=2184
quorumListenOnAllIPs=true
server.1=localhost:2882:3882
server.2=localhost:2883:3883
server.3=localhost:2884:3884
4、启动zookeeper,./start-zookeeper.sh