Linux下安裝Zookeeper


Zookeeper是一個協調服務,可以用它來作為配置維護、名字服務、分布式部署;

下面,我來分享一下在Linux下安裝Zookeeper的整個步驟,讓大家少走彎路。

 

一、Zookeeper下載

 

 
  1. [root@localhost 下載]# wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz  
  2. --2017-02-15 13:15:57--  http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz  
  3. 正在解析主機 mirror.bit.edu.cn (mirror.bit.edu.cn)... 114.247.56.117  
  4. 正在連接 mirror.bit.edu.cn (mirror.bit.edu.cn)|114.247.56.117|:80... 已連接。  
  5. 已發出 HTTP 請求,正在等待回應... 200 OK  
  6. 長度:11833706 (11M) [application/octet-stream]  
  7. 正在保存至: “zookeeper-3.3.6.tar.gz”  
  8.   
  9. 100%[======================================================================================================================================================================================>] 11,833,706   171KB/s 用時 68s      
  10.   
  11. 2017-02-15 13:17:07 (170 KB/s) - 已保存 “zookeeper-3.3.6.tar.gz” [11833706/11833706])  

 

 

二、解壓

 

 

[root@localhost deploy]# tar -zxvf /home/lk/下載/zookeeper-3.3.6.tar.gz   

 

解壓完之后,會在deploy文件夾下面得到一個zookeeper-3.4.11的文件夾


三、進入到conf目錄

 

 

[root@localhost deploy]# cd /opt/deploy/zookeeper-3.4.11/conf  


四、拷貝zoo_samle.cfg為zoo.cfg

 

 

[plain]  view plain  copy
 
 print?
  1. [root@localhost conf]# cp zoo_sample.cfg zoo.cfg  

 

 

五、編輯zoo.cfg文件

 

[plain]  view plain  copy
 
 print?
  1. [root@localhost conf]# vi zoo.cfg   

 

修改為:

 

 
  1. # The number of milliseconds of each tick  
  2. tickTime=2000  
  3. # The number of ticks that the initial  
  4. # synchronization phase can take  
  5. initLimit=10  
  6. # The number of ticks that can pass between  
  7. # sending a request and getting an acknowledgement  
  8. syncLimit=5  
  9. # the directory where the snapshot is stored.  
  10. dataDir=/usr/zookeeper  
  11. dataLogDir=/usr/zookeeper/log  
  12. # the port at which the clients will connect  
  13. clientPort=2181  
  14. server.1=192.168.147.128:3888  



 

六、設置環境變量

 

 
  1. [root@localhost conf]# export ZOOKEEPER_INSTALL=/opt/deploy/zookeeper-3.3.6  
  2. [root@localhost conf]# export PATH=$PATH:$ZOOKEEPER_INSTALL/bin  


七、啟動

 

 

[plain]  view plain  copy
 
 print?
  1. [root@localhost bin]# ./zkServer.sh start  
  2. JMX enabled by default  
  3. Using config: /opt/deploy/zookeeper-3.4.11/bin/../conf/zoo.cfg  
  4. Starting zookeeper ... STARTED  
  5. [root@localhost bin]#   


八、測試zookeeper

 

 

 
  1. [root@localhost bin]# ./zkCli.sh -server 192.168.147.128:2181  

 

如果是本地連接,那么不需要  默認是本地

 

注意:如果出現拒絕連接,請檢查如下:

 

1、防火牆是否關閉  systemctl stop firewalld

 


免責聲明!

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



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