zookeeper配置
cd zk/conf
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg
修改:
dataDir=/usr/local/zk/data
新增:
server.0=sparkproject1:2888:3888
server.1=sparkproject2:2888:3888
server.2=sparkproject3:2888:3888
同步配置
mkdir /usr/local/zk/data
ssh sparkproject2 "rm -rf /usr/local/zk"
ssh sparkproject3 "rm -rf /usr/local/zk"
scp -r /usr/local/zk root@sparkproject2:/usr/local/zk
scp -r /usr/local/zk root@sparkproject3:/usr/local/zk
设置myid
echo 0 > /usr/local/zk/data/myid
ssh sparkproject2 "echo 1 > /usr/local/zk/data/myid"
ssh sparkproject3 "echo 2 > /usr/local/zk/data/myid"
测试Zookeeper
所有服务器执行
zkServer.sh status
应该会产生一个leader两个follower