在 CentOS7 上安裝 zookeeper-3.5.2 服務


  1 [root@centos-linux src]# pwd 
  2 /usr/local/src
  3 
  4 # 1、創建 /usr/local/src/zookeeper 文件夾   5 [root@centos-linux src]# mkdir -p /usr/local/src/zookeeper
  6 
  7 # 2、進入到 /usr/local/src/zookeeper 目錄中   8 [root@centos-linux src]# cd /usr/local/src/zookeeper
  9 
 10 # 3、下載 zookeeper-3.5.2-alpha.tar.gz  11 [root@centos-linux zookeeper]# wget http://mirrors.shu.edu.cn/apache/zookeeper/zookeeper-3.5.2-alpha/zookeeper-3.5.2-alpha.tar.gz
 12 --2018-04-20 19:48:09-- http://mirrors.shu.edu.cn/apache/zookeeper/zookeeper-3.5.2-alpha/zookeeper-3.5.2-alpha.tar.gz
 13 正在解析主機 mirrors.shu.edu.cn (mirrors.shu.edu.cn)... 202.121.199.235
 14 正在連接 mirrors.shu.edu.cn (mirrors.shu.edu.cn)|202.121.199.235|:80... 已連接。
 15 已發出 HTTP 請求,正在等待回應... 200 OK
 16 長度:18443679 (18M) [application/x-gzip]
 17 正在保存至: “zookeeper-3.5.2-alpha.tar.gz”
 18 
 19 100%[=========================================================================>] 18,443,679 126KB/s 用時 2m 24s
 20 
 21 2018-04-20 19:50:33 (125 KB/s) - 已保存 “zookeeper-3.5.2-alpha.tar.gz” [18443679/18443679])
 22 
 23 #4、解壓縮 zookeeper-3.5.2-alpha.tar.gz  24 [root@centos-linux zookeeper]# tar -zxvf zookeeper-3.5.2-alpha.tar.gz
 25 
 26 #5、進入到 /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/conf 目錄中  27 
 28 [root@centos-linux zookeeper]# cd zookeeper-3.5.2-alpha/conf
 29 [root@centos-linux conf]# ls
 30 configuration.xsl log4j.properties zoo_sample.cfg
 31 
 32 # 6、復制 zoo_sample.cfg 文件的並命名為為 zoo.cfg  33 [root@centos-linux conf]# cp zoo_sample.cfg zoo.cfg
 34 [root@centos-linux conf]# ls
 35 configuration.xsl log4j.properties zoo.cfg zoo_sample.cfg
 36 
 37 # 7、用 vim 打開 zoo.cfg 文件並修改其內容為如下  38 [root@centos-linux conf]# vim zoo.cfg
 39 
 40 # dataDir=/tmp/zookeeper
 41 # The number of milliseconds of each tick
 42 tickTime=2000
 43 # The number of ticks that the initial 
 44 # synchronization phase can take
 45 initLimit=10
 46 # The number of ticks that can pass between 
 47 # sending a request and getting an acknowledgement
 48 syncLimit=5
 49 # the directory where the snapshot is stored.
 50 # do not use /tmp for storage, /tmp here is just 
 51 # example sakes.
 52 # dataDir=/tmp/zookeeper
 53 #數據文件夾  54 dataDir=/urs/local/src/zookeeper/zookeeper-3.5.2-alpha/data  55 #日志文件夾  56 dataLogDir=/urs/local/src/zookeeper/zookeeper-3.5.2-alpha/logs  57 # the port at which the clients will connect
 58 clientPort=2181
 59 # the maximum number of client connections.
 60 # increase this if you need to handle more clients
 61 #maxClientCnxns=60
 62 #
 63 # Be sure to read the maintenance section of the 
 64 # administrator guide before turning on autopurge.
 65 #
 66 
 67 # 8、保存並關閉 zoo.cfg 文件  68 [root@centos-linux conf]# cd ..
 69 [root@centos-linux zookeeper-3.5.2-alpha]# cd bin
 70 [root@centos-linux bin]# ls
 71 README.txt zkCleanup.sh zkCli.cmd zkCli.sh zkEnv.cmd zkEnv.sh zkServer.cmd zkServer-initialize.sh zkServer.sh
 72 
 73 #9、用 vim 打開 /etc/ 目錄下的配置文件 profile  74 
 75 [root@centos-linux bin]# vim /etc/profile
 76 
 77 #10、並在其尾部追加如下內容  78 
 79 # idea - zookeeper-3.5.2 config start - 2017-04-20
 80 
 81 export ZOOKEEPER_HOME=/usr/local/src/zookeeper/zookeeper-3.5.2-alpha/
 82 export PATH=$ZOOKEEPER_HOME/bin:$PATH  83 export PATH  84 
 85 # idea - zookeeper-3.5.2 config end - 2017-04-20
 86 
 87 # 11、使 /etc/ 目錄下的 profile 文件即可生效  88 [root@centos-linux bin]# source /etc/profile
 89 
 90 # 12、啟動 zookeeper 服務  91 
 92 [root@centos-linux bin]# zkServer.sh start
 93 ZooKeeper JMX enabled by default
 94 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg
 95 Starting zookeeper ... STARTED
 96 
 97 #13、查詢 zookeeper 狀態  98 [root@centos-linux bin]# zkServer.sh status
 99 ZooKeeper JMX enabled by default
100 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg
101 Client port found: 2181. Client address: localhost.
102 Mode: standalone
103 
104 # 14、關閉 zookeeper 服務 105 [root@centos-linux bin]# zkServer.sh stop
106 ZooKeeper JMX enabled by default
107 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg
108 Stopping zookeeper ... STOPPED
109 [root@centos-linux bin]# zkServer.sh start 
110 ZooKeeper JMX enabled by default
111 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg
112 Starting zookeeper ... STARTED
113 
114 # 15、重啟 zookeeper 服務 115 [root@centos-linux bin]# zkServer.sh restart
116 ZooKeeper JMX enabled by default
117 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg
118 ZooKeeper JMX enabled by default
119 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg
120 Stopping zookeeper ... STOPPED
121 ZooKeeper JMX enabled by default
122 Using config: /usr/local/src/zookeeper/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfg
123 Starting zookeeper ... STARTED

 


免責聲明!

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



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