Zookeeper集群搭建
ymc4
10年前
zookeeper安装
192.168.19.210(myid=210) 192.168.19.211(myid=211) 192.168.19.212(myid=212)
下载zookeeper
cd /tmp wget -N http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz tar -zxf zookeeper-3.4.5.tar.gz mv ./zookeeper-3.4.5 /opt/zookeeper mkdir /opt/zookeeper/data mkdir /opt/zookeeper/logs echo 'tickTime=2000' > /opt/zookeeper/conf/zoo.cfg echo 'initLimit=10' >> /opt/zookeeper/conf/zoo.cfg echo 'syncLimit=5' >> /opt/zookeeper/conf/zoo.cfg echo 'dataDir=/opt/zookeeper/data' >> /opt/zookeeper/conf/zoo.cfg echo 'dataLogDir=/opt/zookeeper/logs' >> /opt/zookeeper/conf/zoo.cfg echo 'clientPort=2181' >> /opt/zookeeper/conf/zoo.cfg #server.myid=192.168.19.XXX:2888:3888 echo 'server.210=192.168.19.210:2888:3888' >> /opt/zookeeper/conf/zoo.cfg echo 'server.211=192.168.19.211:2888:3888' >> /opt/zookeeper/conf/zoo.cfg echo 'server.212=192.168.19.212:2888:3888' >> /opt/zookeeper/conf/zoo.cfg #192.168.19.210 echo '210' > /opt/zookeeper/data/myid #192.168.19.211 echo '211' > /opt/zookeeper/data/myid #192.168.19.212 echo '212' > /opt/zookeeper/data/myid
开机启动
echo '/opt/zookeeper/bin/zkServer.sh start' >> /etc/rc.d/rc.local
环境变量
echo 'export PATH=$PATH:/opt/zookeeper/bin' >> /etc/profile source /etc/profile
ZooKeeper服务命令
/opt/zookeeper/bin/zkServer.sh start /opt/zookeeper/bin/zkServer.sh status /opt/zookeeper/bin/zkServer.sh stop /opt/zookeeper/bin/zkServer.sh restart