linux 安裝zookeeper


3.4 linux 安裝zookeeper

下載zookeeper安裝包

https://downloads.apache.org/zookeeper/zookeeper-3.5.9/

 

上傳zookeeper 的安裝包到Linux 服務器上面

 # 上傳到 /myapp 下
 /myapp

 

解壓apache-zookeeper-3.5.9-bin.tar.gz

  tar -zxvf apache-zookeeper-3.5.9-bin.tar.gz 

 

把解壓后的文件移動到指定位置, 這里統一移動到 /myapp/software 目錄下

  mv apache-zookeeper-3.5.9-bin /myapp/software/

 

在 /data 目錄下創建一個文件夾 zookeeper 用來存放zookeeper 的數據文件

 cd /data
 mkdir zookeeper

 

復制cp zoo_sample.cfg zoo.cfg

 #進入 /myapp/software/apache-zookeeper-3.5.9-bin/conf 目錄
 cd /myapp/software/apache-zookeeper-3.5.9-bin/conf
 # 復制 zoo_sample.cfg 文件,並重命名為zoo.cfg 否則zookeeper不會生效
 cp zoo_sample.cfg zoo.cfg

 

編輯 zoo.cfg 文件,

修改 dataDir 屬性等於 /tmp/zookeeper 如下第13行所示

 # 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=/tmp/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
 

 

啟動/關閉/查看狀態 zookeeper 服務

 # 1.進入zookeeper安裝目錄的bin 目錄
 /myapp/software/apache-zookeeper-3.5.9-bin/bin
 # 2. 啟動zookeeper
 ./zkServer.sh start
 # 3. 關閉zookeeper
 ./zkServer.sh stop
 # 4. 查看zookeeper的狀態
 ./zkServer.sh status

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM