ZooKeeper 安裝,啟動,驗證

2021-07-10 13:29:33 字數 1486 閱讀 5595

**:

tar -zxvf zk-.tar.gz
修改zk配置,將zk安裝目錄下conf/zoo_sample.cfg重新命名zoo.cfg,修改其中的內容:

# the number of milliseconds of each tick

# 伺服器與客戶端之間互動的基本時間單元(ms)

ticktime=2000

# the number of ticks that the initial

# synchronization phase can take

# zookeeper所能接受的客戶端數量

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.

# 儲存zookeeper資料,日誌的路徑

datadir=/home/hadoop/data/zookeeper

# the port at

which

the clients will connect

# 客戶端與zookeeper相互互動的埠

clientport=2181

server.

1= dn1:2888:3888

server.

2= dn2:2888:3888

server.

3= dn3:2888:3888

#server.a=b:c:d 其中a是乙個數字,代表這是第幾號伺服器;b是伺服器的ip位址;c表示伺服器與群集中的「領導者」交換資訊的埠;當領導者失效後,d表示用來執行選舉時伺服器相互通訊的埠。

接下來,在配置的datadir目錄下建立乙個myid檔案,裡面寫入乙個0-255之間的乙個隨意數字,每個zk上這個檔案的數字要是不一樣的,這些數字應該是從1開始,依次寫每個伺服器。檔案中序號要與dn節點下的zk配置序號一直,如:server.1=dn1:2888:3888,那麼dn1節點下的myid配置檔案應該寫上1。

分別在各個dn節點啟動zk程序,命令如下:

bin/zkserver.sh start
然後,在各個節點輸入jps命令,會出現如下程序:

quorumpeermain
上面說的輸入jps命令,若顯示對應的程序,即表示啟動成功,同樣我們也可以輸入zk的狀態命令檢視,命令如下:

bin/zkserver.sh status
會出現乙個leader和兩個follower。

Linux安裝zookeeper並驗證

進入到 usr zookeeper zookeeper3 4.10 bin 目錄中 root master cd usr zookeeper zookeeper 3.4.10 root master bin zkserver.sh start root master bin zkserver.sh ...

zookeeper安裝及啟動程序

the number of milliseconds of each tick 伺服器與客戶端之間互動的基本時間單元 ms ticktime 2000 the number of ticks that the initial synchronization phase can take zookee...

Zookeeper基本安裝和啟動

二 配置zookeeper 三 啟動zookeeper cd ny soft tar xzvf apache zookeeper 3.6.2 bin.tar.gz cd apache zookeeper 3.6.2 bin 修改配置檔案 切換到zookeeper的conf目錄下 cd apache ...