多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[https://www.cnblogs.com/qingyunzong/p/8619184.html](https://www.cnblogs.com/qingyunzong/p/8619184.html) #### 下载 ``` cd ~/soft/ wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz ``` #### 解压 ``` tar -zxvf apache-zookeeper-3.5.5.tar.gz mv apache-zookeeper-3.5.5 zookeeper ``` #### 配置环境变量 ``` vi ~/.bash_profile ``` ``` # zookeeper export ZOOKEEPER_HOME=/home/bigdata/soft/zookeeper export PATH=$PATH:$ZOOKEEPER_HOME/bin ``` ``` source ~/.bash_profile ``` #### 配置 ``` vim $ZOOKEEPER_HOME/conf/zoo.cfg ``` ``` # The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial # synchronization phase can take initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. dataDir=/home/bigdata/data/zookeeper # the port at which the clients will connect clientPort=2181 # the maximum number of client connections. # increase this if you need to handle more clients #maxClientCnxns=60 # # Be sure to read the maintenance section of the # administrator guide before turning on autopurge. # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # The number of snapshots to retain in dataDir #autopurge.snapRetainCount=3 # Purge task interval in hours # Set to "0" to disable auto purge feature #autopurge.purgeInterval=1 dataLogDir=/home/bigdata/log/zookeeper server.1=bd00:2888:3888 server.2=bd01:2888:3888 server.3=bd02:2888:3888 ``` ``` mkdir -p /home/bigdata/data/zookeeper mkdir -p /home/bigdata/log/zookeeper cd /home/bigdata/data/zookeeper echo 1 > myid ``` #### 启动 ``` zkServer.sh start ``` #### 查看集群状态,主从信息 ``` zkServer.sh status ```