zookeeper以及集群的搭建

2021-08-03 13:49:00 字數 2194 閱讀 3042

1.zookeeper的搭建不難,難的是對他的理解以及良好的使用.單機版的zookeeper只需要解壓後直接命令 啟動即可 解壓zookeeper,tar -zxvf zookeeper-3.4.6.tar.g

2.集群的話,需要複製檔案 把單機版的zookeeper-3.4.6拷貝到/usr/local/solrcloud下,複製三份分別並將目錄名改為zookeeper1、zookeeper2、zookeeper3

3.進入zookeeper1資料夾,建立data目錄。並在data目錄中建立乙個myid檔案內容為「1」(echo 1 >> data/myid)。

4.進入conf資料夾,把zoo_sample.cfg改名為zoo.cfg

5.修改zoo.cfg。 修改: datadir=/usr/local/solrcloud/zookeeper1/data clientport=2181(zookeeper2中為2182、zookeeper3中為2183) 新增: server.1=192.168.25.150:2881:3881 server.2=192.168.25.150:2882:3882 server.3=192.168.25.150:2883:3883

6.接下來把剩下的兩個全部按照這個方式來修改 注意:第二個的埠號和路徑要改,而新增的server不變 後面埠依次改為2182和2183

# 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=/usr/local/solrcloud/zookeeper1/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. #

# l#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.25.150:2881:3881

server.2=192.168.25.150:2882:3882

server.3=192.168.25.150:2883:3883

7.修改完成後分別啟動三個zookeeper /usr/local/solrcloud/zookeeper1/bin/zkserver.sh start /usr/local/solrcloud/zookeeper2/bin/zkserver.sh start

/usr/local/solrcloud/zookeeper3/bin/zkserver.sh start

8.檢視zookeeper的狀態 /usr/local/solrcloud/zookeeper1/bin/zkserver.sh status /usr/local/solrcloud/zookeeper2/bin/zkserver.sh status /usr/local/solrcloud/zookeeper3/bin/zkserver.sh status

9.最後記得新增埠號,或者關閉防火牆

zookeeper在linux上的集群搭建

1.用stfp等檔案傳輸軟體將linux版本的zookeeper傳輸到linux中 2.在檔案中進行解壓命令為 tar zxvf 檔名 路徑 檔名 c 解壓路徑 3.可以將解壓後的一些無用檔案刪除 doc src 1.進入conf這個檔案中,複製zoo sample.cfg並改名為zoo.cfg 2...

centos7 zookeeper集群的搭建

說明 該集群的搭建是為了服務於solr集群,請參考我的關於solr集群搭建的部落格。1 建立solr cloud目錄 mkdir usr local solr cloud2 將解壓的apache zookeeper 3.5.5 bin複製三份到solr cloud目錄中 cp r apache zo...

5 2 搭乙個zookeeper集群

在第乙個已經啟動起來的zookeeper,如果停止,用.zkserver.sh stop 如果要搭集群,那麼一定要修改配置檔案 在conf裡面的zoo.cfg裡修改 vim zoo.cfg 詳細解釋 zookeeper的預設配置檔案為zookeeper conf zoo sample.cfg,需要將...