1倡缠、創(chuàng)建 ~/DevToolKit 文件夾:
2丸卷、進(jìn)入到 /DevToolKit 目錄中:
? ? cd ~/DevToolKit/
3蔚出、下載 zookeeper-3.4.10.tar.gz:
? ? wget?https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
4汹粤、解壓縮 zookeeper-3.4.10.tar.gz:
? ? tar -zxvf zookeeper-3.4.10.tar.gz
5射亏、進(jìn)入到 /home/jiangyi/DevToolKit/zookeeper-3.4.10/conf 目錄中:
? ? cd zookeeper-3.4.10/conf/
6近忙、復(fù)制 zoo_sample.cfg 文件的并命名為為 zoo.cfg:
? ? cp zoo_sample.cfg zoo.cfg
7、用 vim 打開(kāi) zoo.cfg 文件并修改其內(nèi)容為如下:
? ? # The number of milliseconds of each tick
? ? # zookeeper 定義的基準(zhǔn)時(shí)間間隔智润,單位:毫秒
? ? 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=/tmp/zookeeper
? ? # 數(shù)據(jù)文件夾
? ? dataDir=/home/jiangyi/DevToolKit/zookeeper-3.4.10/data
? ? # 日志文件夾
? ? dataLogDir=/home/jiangyi/DevToolKit/zookeeper-3.4.10/logs
? ? # the port at which the clients will connect
? ? # 客戶(hù)端訪(fǎng)問(wèn) zookeeper 的端口號(hào)
? ? 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
8及舍、保存并關(guān)閉 zoo.cfg 文件:
9、進(jìn)入到 /usr/local/services/zookeeper/zookeeper-3.4.9/bin 目錄中:
? ? cd ../bin/
10窟绷、用 vim 打開(kāi) /etc/ 目錄下的配置文件 profile:
? ? vim /etc/profile
? ? 并在其尾部追加如下內(nèi)容:
? ? export ZOOKEEPER_HOME=/home/jiangyi/DevToolKit/zookeeper-3.4.10/
? ? export PATH=$ZOOKEEPER_HOME/bin:$PATH
? ? export PATH
11锯玛、使 /etc/ 目錄下的 profile 文件即可生效:
? ? source /etc/profile
12、啟動(dòng) zookeeper 服務(wù):
? ? zkServer.sh start
13兼蜈、查詢(xún) zookeeper 狀態(tài):
? ? zkServer.sh status
14攘残、關(guān)閉 zookeeper 服務(wù):
? ? zkServer.sh stop
15、重啟 zookeeper 服務(wù):
? ? zkServer.sh restart
16. 切換到root用戶(hù)为狸,設(shè)置防火墻歼郭,ip屏蔽取消
firewall-cmd --permanent --add-port=2181/tcp
firewall-cmd --permanent --add-port=20880/tcp
firewall-cmd --permanent --add-port=20881/tcp
firewall-cmd --permanent --add-port=29060/tcp
firewall-cmd --reload
systemctl restart firewalld.service