天天看點

zookeeper安裝(單節點)及基本操作zookeeper安裝(單節點)及基本操作

zookeeper安裝(單節點)及基本操作

本文主要介紹如何安裝單點的zookeeper,并且會介紹一下zookeeper的實用工具。 好,下面上貨。 本文主要參考: 官網:https://zookeeper.apache.org/

下載下傳位址:https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/stable/

參考文檔:https://zookeeper.apache.org/doc/trunk/zookeeperStarted.html

1、首先在下載下傳地中下載下傳最新的zookeper安裝包。 2、把安裝包tar開,到指定的檔案夾。 3、修改配置檔案zookeeper/conf/zoo.cfg,如果沒有需要從zoo_example.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=/data/zookeeperdata
# the port at which the clients will connect
clientPort=2181
           

4、啟動zookeeper(注意修改環境變量 vim /etc/profile)。 使用指令zkServer.sh start

5、啟動後,檢視一下zookeeper的運作狀态。 lsof -i:2181

zookeeper安裝(單節點)及基本操作zookeeper安裝(單節點)及基本操作

6、使用工具zookeeperInspector對zookeeper中的資料進行監控(這個工具可以在我的百度網盤上下載下傳http://pan.baidu.com/s/1eS09oxs)

7、運作這個工具後,可以對zookeeper中的資料進行監控。

zookeeper安裝(單節點)及基本操作zookeeper安裝(單節點)及基本操作

8、使用zookeeper的zkCli對zookeeper進行操作。具體的使用指令是./zlCli.sh -server 192.169.0.11:2181。進入後能夠正常的使用zk的指令了。 檢視節點 ls / 添加節點 create /zk_test c 添加子節點 create /zk_test/data c 删除節點 delete /zk_test/data

ok!本文就介紹到這裡。