linux下搭建zookeeper集群
生活随笔
收集整理的這篇文章主要介紹了
linux下搭建zookeeper集群
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
linux下搭建zookeeper集群
1、準備
1、下載zookeeper壓縮包 (注:下載3.4.14版本,3.5以上運行時會少jar包) 2、系統:centOS7 安裝好java環境 3、將壓縮包上傳到3臺服務器上,并解壓 4、解壓后重命名 zookeeper01 zookeeper02 zookeeper03 (方便觀察)(cp -r zookeeper-3.4.14.jar zookeeper01)zookeeper下載鏈接
2、配置zookeeper配置文件
1、進入zookeeper里的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/soft/zookeeper03/data //數據存放位置 # 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 server.1=192.168.0.211:2881:3881 //3個集群serverip端口等。(server.1表示server名稱,192.168.0.211表示ip 2881表示集群內部通訊端口,3881表示選舉端口,下面一樣。) server.2=192.168.0.212:2882:3882 server.3=192.168.0.213:2883:3883 2、創建dada目錄(不然會啟動報錯,目錄的路徑為zoo.cfg里面配置的路徑)mkdir data3、啟動、測試
1、啟動:./bin/zkServer.sh start注:(windows環境下不需要start) 2、檢查是否啟動成功執行jps命令查看 3、測試 其余2臺服務器重復執行上述操作并全部啟動成功后 執行./zkServer.sh status
4、遇到的問題
1、 問題:下載的zookeeper版本為3.5以上時運行會報以下錯誤 Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain 解釋:該錯誤為找不到主類,是因為3.5以上版本都少了一個zookeeper-***.jar (***表示版本號) 解決:去官網下該版本的jar或者重新下一個3.4.*版本的zookeeper壓縮包進行搭建2、 問題:運行啟動命令沒有報錯但是查看log時發現有如下報錯no route to host解釋:服務器防火墻處于啟動狀態并且沒有開放端口解決:關閉防火墻或者開放所需端口總結
以上是生活随笔為你收集整理的linux下搭建zookeeper集群的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [源码和文档分享]基于JAVA的葫芦娃
- 下一篇: 怎么才能提高实验室管理水平?运用LIMS