ZooKeeper安裝模式主要有3種:
- 單機(jī)版(Standalone模式)模式:僅有一個ZooKeeper服務(wù)
- 偽集群模式:單機(jī)多個ZooKeeper服務(wù)
- 集群模式:多機(jī)多ZooKeeper服務(wù)
1 單機(jī)版(Standalone模式)安裝
ZooKeeper官網(wǎng)下載地址:http://zookeeper.apache.org/releases.html#download
如圖所示進(jìn)行操作:
注意一點(diǎn)饲漾,如果不想當(dāng)小白鼠蝙搔,請務(wù)必下穩(wěn)定版(stable release),非穩(wěn)定版安裝時可能出各種未知的異常考传。
以
3.4.14
版本為例吃型,在Centos系統(tǒng)
下進(jìn)行安裝,之前寫一些軟件的安裝教程時,有人留言說希望把安裝的步驟盡量詳細(xì)化僚楞,包括安裝路徑也要帶上勤晚,做到可以照著教程復(fù)制操作。這個要求有點(diǎn)泉褐,呵呵赐写,滿足你!
1.1 下載安裝包
輸入如下命令:
wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
如下圖:
1.2 解壓安裝包
tar -zxvf apache-zookeeper-3.4.14.tar.gz
解壓完成后膜赃,將解壓包移動到/usr目錄:
mv apache-zookeeper-3.4.14 /usr/
并將apache-zookeeper-3.4.14重命名為zookeeper-3.4.14挺邀。
至此可以看到ZooKeeper的目錄結(jié)構(gòu)如下:
[root@instance-e5cf5719 zookeeper-3.4.14]# ls
bin data ivy.xml logs README.md zookeeper-3.4.14.jar zookeeper-3.4.14.jar.sha1 zookeeper-docs zookeeper-recipes
build.xml dist-maven lib NOTICE.txt README_packaging.txt zookeeper-3.4.14.jar.asc zookeeper-client zookeeper-it zookeeper-server
conf ivysettings.xml LICENSE.txt pom.xml src zookeeper-3.4.14.jar.md5 zookeeper-contrib zookeeper-jute
- bin目錄——zk的可執(zhí)行腳本目錄,包括zk服務(wù)進(jìn)程跳座,zk客戶端悠夯,等腳本。其中躺坟,.sh是Linux環(huán)境下的腳本沦补,.cmd是Windows環(huán)境下的腳本。
- conf目錄——配置文件目錄咪橙。zoo_sample.cfg為樣例配置文件夕膀,需要修改為自己的名稱,一般為zoo.cfg美侦。log4j.properties為日志配置文件产舞。
1.3 設(shè)置zoo.cfg
進(jìn)入/usr/zookeeper-3.4.14/conf目錄,可以看到zoo_sample.cfg菠剩,這是樣例配置文件易猫,需要修改為自己的,一般命令為zoo.cfg 具壮。
cp zoo_sample.cfg zoo.cfg
可以看看zoo.cfg文件里的內(nèi)容:
# 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=/tmp/zookeeper
# 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
看著好復(fù)雜的感覺准颓,其實(shí)去掉注釋后,就只有幾行而已:
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper
clientPort=2181
-
tickTime=2000 :通俗點(diǎn)叫
滴答時間
棺妓,就是心跳間隔攘已,默認(rèn)是2000毫秒,即每隔兩秒心跳一次怜跑。- tickTime用于客戶端與服務(wù)器或服務(wù)器與服務(wù)器之間維持心跳的時間度量單位样勃,即每隔tickTime會發(fā)送一次心跳。
- 心跳的作用:
- 監(jiān)聽機(jī)器的工作狀態(tài)。
- 通過心跳來控制follower跟leader的通信時間峡眶,默認(rèn)情況下他們(follower和leader)的會話時長是心跳間隔的兩倍剧防,即2 * tickTime。
- initLimit=10:follower在啟動過程中辫樱,會從leader同步所有最新數(shù)據(jù)诵姜,然后確定自己能夠?qū)ν夥?wù)的起始狀態(tài),leader允許follower在initLimit時間內(nèi)完成工作搏熄。默認(rèn)值是10,即10*tickTime暇赤。默認(rèn)情況下不需要修改該配置項(xiàng)心例,隨著ZooKeeper集群管理的數(shù)量不斷增大,follower節(jié)點(diǎn)在啟動的時候鞋囊,從leader節(jié)點(diǎn)進(jìn)行數(shù)據(jù)同步的時間也會相應(yīng)變長止后,于是無法在較短的時間內(nèi)完成數(shù)據(jù)同步,在這種情況下溜腐,需要適當(dāng)調(diào)大這個參數(shù)译株。
- syncLimit=5:leader節(jié)點(diǎn)和follower節(jié)點(diǎn)進(jìn)行心跳檢測的最大延遲時間。在ZooKeeper集群中挺益,leader節(jié)點(diǎn)會與所有的follower節(jié)點(diǎn)進(jìn)行心跳檢測來確認(rèn)節(jié)點(diǎn)是否存活。默認(rèn)值為5,即5*tickTime熙掺。
- dataDir=/tmp/zookeeper:ZooKeeper服務(wù)器存儲快照文件的默認(rèn)目錄佑钾。/tmp目錄下的文件可能被自動刪除,容易丟失烂翰,需要修改存放目錄夯缺。
- clientPort=2181: 客戶端連接ZooKeeper服務(wù)器的端口。ZooKeeper會監(jiān)聽這個端口甘耿,接收客戶端的訪問請求踊兜。
溫馨提示
:大家一定要學(xué)會看官方文檔,去接收第一手資料佳恬。雖然是英文捏境,但用詞和語法都比較簡單,很容易看懂毁葱。
官網(wǎng)介紹如下:
- tickTime : the basic time unit in milliseconds used by ZooKeeper. It is used to do heartbeats and the minimum session timeout will be twice the tickTime.
- dataDir : the location to store the in-memory database snapshots and, unless specified otherwise, the transaction log of updates to the database.
- clientPort : the port to listen for client connections
在zookeeper-3.4.14目錄下創(chuàng)建data和logs文件典蝌,如下:
[root@instance-e5cf5719 zookeeper-3.4.14]# mkdir data
[root@instance-e5cf5719 zookeeper-3.4.14]# mkdir logs
官方文檔也有對此進(jìn)行說明,指出在生產(chǎn)環(huán)境中ZooKeeper是會長期運(yùn)行的头谜,ZooKeeper的存儲就需要專門的文件位置進(jìn)行存儲dataDir和logs骏掀。
data文件夾用于存放內(nèi)存數(shù)據(jù)庫快照,集群的myid文件也是存放在這個文件夾下。
For long running production systems ZooKeeper storage must be managed externally (dataDir and logs).
修改后的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=/tmp/zookeeper
# 數(shù)據(jù)文件夾
dataDir=/usr/zookeeper-3.4.14/data
# 日志文件夾
dataLogDir=/usr/zookeeper-3.4.14/logs
# 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
1.4 啟動
進(jìn)入ZooKeeper的bin目錄:
[root@instance-e5cf5719 zookeeper-3.4.14]# cd bin/
[root@instance-e5cf5719 bin]# ls
README.txt zkCleanup.sh zkCli.cmd zkCli.sh zkEnv.cmd zkEnv.sh zkServer.cmd zkServer.sh zkTxnLogToolkit.cmd zkTxnLogToolkit.sh zookeeper.out
- zkCleanup.sh :用于清理ZooKeeper的歷史數(shù)據(jù)截驮,包括事務(wù)日志文件與快照數(shù)據(jù)文件
- zkCli.sh:連接ZooKeeper服務(wù)器的命令行客戶端
- zkEnv.sh:設(shè)置環(huán)境變量
- zkServer.sh:啟動ZooKeeper服務(wù)器
啟動ZooKeeper:
./zkServer.sh start
成功啟動如下圖所示:
可以查看ZooKeeper的狀態(tài):
./zkServer.sh status
狀態(tài)信息如下圖所示:
可以通過
help
看看./zkServer.sh下的命令
[root@instance-e5cf5719 bin]# ./zkServer.sh help
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.14/bin/../conf/zoo.cfg
Usage: ./zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}
- start: 啟動笑陈,用于后臺啟動ZooKeeper服務(wù)器
- start-foreground: 前臺啟動服務(wù)器
- stop:停止
- restart:重啟
- status:獲取狀態(tài)
- upgrade:升級
- print-cmd : 打印ZooKeeper程序命令行及相關(guān)參數(shù)
1.5 連接ZooKeeper客戶端
進(jìn)行連接:
./zkCli.sh -server 127.0.0.1:2181
即
./zkCli.sh -server <ip>:<port>
結(jié)果如下:
可以通過help獲取更多的相關(guān)命令:
[zk: 127.0.0.1:2181(CONNECTED) 0] help
ZooKeeper -server host:port cmd args
stat path [watch]
set path data [version]
ls path [watch]
delquota [-n|-b] path
ls2 path [watch]
setAcl path acl
setquota -n|-b val path
history
redo cmdno
printwatches on|off
delete path [version]
sync path
listquota path
rmr path
get path [watch]
create [-s] [-e] path data acl
addauth scheme auth
quit
getAcl path
close
connect host:port
命令 | 描述 |
---|---|
help | 顯示所有操作命令 |
stat | 查看節(jié)點(diǎn)狀態(tài),即判斷節(jié)點(diǎn)是否存在 |
set | 更新節(jié)點(diǎn)數(shù)據(jù) |
get | 獲取節(jié)點(diǎn)數(shù)據(jù) |
ls path [watch] | 使用 ls 命令來查看當(dāng)前znode的內(nèi)容 |
create | 普通創(chuàng)建 ; -s 含有序列;-e 臨時(重啟或者超時消失) |
delete | 刪除節(jié)點(diǎn) |
rmr | 遞歸刪除節(jié)點(diǎn) |
可以對相關(guān)的命令進(jìn)行一些簡單的測試葵袭,先創(chuàng)建一個新znode(運(yùn)行create
/zk_test my_data )涵妥,里面附帶的信息為“my_data”.
[zk: 127.0.0.1:2181(CONNECTED) 1] create /zk_test my_data
Created /zk_test
[zk: 127.0.0.1:2181(CONNECTED) 2] ls /
[zookeeper, zk_test]
可以看到zk_test創(chuàng)建成功了∑挛可以通過get
命令看看zk_test節(jié)點(diǎn)里的信息:
[zk: 127.0.0.1:2181(CONNECTED) 3] get /zk_test
my_data
cZxid = 0x7
ctime = Thu Dec 05 16:32:20 CST 2019
mZxid = 0x7
mtime = Thu Dec 05 16:32:20 CST 2019
pZxid = 0x7
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 7
numChildren = 0
通過set
可以修改zk_test里的信息蓬网。
[zk: 127.0.0.1:2181(CONNECTED) 4] set /zk_test junk
cZxid = 0x7
ctime = Thu Dec 05 16:32:20 CST 2019
mZxid = 0x8
mtime = Thu Dec 05 16:37:03 CST 2019
pZxid = 0x7
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 4
numChildren = 0
[zk: 127.0.0.1:2181(CONNECTED) 5] get /zk_test
junk
cZxid = 0x7
ctime = Thu Dec 05 16:32:20 CST 2019
mZxid = 0x8
mtime = Thu Dec 05 16:37:03 CST 2019
pZxid = 0x7
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 4
numChildren = 0
通過delete
可以刪除節(jié)點(diǎn)。
[zk: 127.0.0.1:2181(CONNECTED) 6] delete /zk_test
[zk: 127.0.0.1:2181(CONNECTED) 7] ls /
[zookeeper]
2 偽集群搭建
我們搭建3個ZooKeeper來構(gòu)建偽集群鹉勒。上面我們已經(jīng)搭建了zookeeper-3.4.14帆锋,現(xiàn)在將它復(fù)制兩份,命名為zookeeper-3.4.14-1禽额,zookeeper-3.4.14-2锯厢。
[root@instance-e5cf5719 usr]# cp -r zookeeper-3.4.14 zookeeper-3.4.14-1
[root@instance-e5cf5719 usr]# cp -r zookeeper-3.4.14 zookeeper-3.4.14-2
此時3個ZooKeeper文件是一模一樣的,構(gòu)建偽集群需要對每個ZooKeeper的配置文件做一點(diǎn)小修改脯倒。
對3個ZooKeeper中/conf/zoo.cfg進(jìn)行修改实辑,主要是修改3個位置:端口號
、日志路徑
藻丢、集群配置
剪撬。
在zoo.cfg配置中,添加了一組server配置悠反,表示ZooKeeper集群中有3個節(jié)點(diǎn)婿奔,server的配置格式如下:
server.<myid>=<IP>:<Port1>:<Port2>
-
myid
:是節(jié)點(diǎn)的編號,該編號的取值范圍是1-255之間的整數(shù)问慎,且在集群中必須唯一萍摊。 -
IP
:表示節(jié)點(diǎn)所在的IP地址,如在本地環(huán)境為127.0.0.1或localhost如叼。 -
Port1
:leader節(jié)點(diǎn)與follower節(jié)點(diǎn)進(jìn)行心跳檢測與數(shù)據(jù)同步時所使用的端口冰木。 -
Port2
:在進(jìn)行l(wèi)eader選舉的過程中,用于投票通信的端口笼恰。
如果是偽集群的配置方式踊沸,由于 ip 都是一樣,所以不同的 Zookeeper 實(shí)例通信端口號不能一樣社证,要給它們分配不同的端口號逼龟。
在每個ZooKeeper文件的/data
目錄下分別創(chuàng)建一個myid
文件,myid文件里只需有服務(wù)器編號(如1追葡,2, 3)腺律。
分別啟動三個ZooKeeper服務(wù)(開啟3個窗口來啟動服務(wù))奕短。
結(jié)果如下:
- zookeeper-3.4.14
[root@instance-e5cf5719 bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.14/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@instance-e5cf5719 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.14/bin/../conf/zoo.cfg
Mode: follower
- zookeeper-3.4.14-1
[root@instance-e5cf5719 bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.14-1/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@instance-e5cf5719 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.14-1/bin/../conf/zoo.cfg
Mode: leader
- zookeeper-3.4.14-2
[root@instance-e5cf5719 bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.14-2/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@instance-e5cf5719 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.14-2/bin/../conf/zoo.cfg
Mode: follower
通過查看狀態(tài)可以看到zookeeper-3.4.14-1是leader
,zookeeper-3.4.14和zookeeper-3.4.14-2是follower
匀钧。
可以參考官網(wǎng)的架構(gòu)圖來輔助理解翎碑。
將zookeeper-3.4.14-1停掉,來觀察下leader的重新選舉之斯。
[root@instance-e5cf5719 bin]# ./zkServer.sh stop
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.14-1/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
分別查看zookeeper-3.4.14和zookeeper-3.4.14-2的狀態(tài)日杈。
[root@instance-e5cf5719 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.14/bin/../conf/zoo.cfg
Mode: follower
[root@instance-e5cf5719 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.14-2/bin/../conf/zoo.cfg
Mode: leader
可以看到zookeeper-3.4.14-2成為了leader。
3 集群模式搭建
集群模式搭建跟偽集群非常相似佑刷,只是集群的ZooKeeper是部署在不同的機(jī)器莉擒,偽集群的ZooKeeper是部署在同一臺機(jī)器,在對/conf/zoo.cfg進(jìn)行修改時瘫絮,因?yàn)槭遣煌臋C(jī)器(ip不同)涨冀,可以不用修改端口號。除了這一點(diǎn)差別外檀何,其它的搭建方式跟偽集群一模一樣,就不做多介紹了廷支。
4 四字命令(ZooKeeper Commands: The Four Letter Words)
ZooKeeper有一個命令行集合频鉴,每個命令由四個字母組成,俗稱四字命令恋拍。
命令 | 官方描述 | 解釋 |
---|---|---|
conf | New in 3.3.0: Print details about serving configuration. | 輸出服務(wù)配置的詳細(xì)信息 |
cons | New in 3.3.0: List full connection/session details for all clients connected to this server. Includes information on numbers of packets received/sent, session id, operation latencies, last operation performed, etc... | 列出連接到該服務(wù)端的所有客戶端的所有連接/會話的詳細(xì)信息垛孔,包括接收/發(fā)送的packet數(shù)量、session id施敢、操作延遲周荐、最后的操作執(zhí)行等 |
crst | New in 3.3.0: Reset connection/session statistics for all connections. | 重置所有connetions的連接/會話統(tǒng)計(jì)信息 |
dump | Lists the outstanding sessions and ephemeral nodes. This only works on the leader. | 列出未完成的會話和臨時節(jié)點(diǎn)。這只對leader有效僵娃。 |
envi | Print details about serving environment | 輸出服務(wù)環(huán)境的詳細(xì)信息 |
ruok | Tests if server is running in a non-error state. The server will respond with imok if it is running. Otherwise it will not respond at all. A response of "imok" does not necessarily indicate that the server has joined the quorum, just that the server process is active and bound to the specified client port. Use "stat" for details on state wrt quorum and client connection information. | 測試服務(wù)是否運(yùn)行正常 |
srst | Reset server statistics. | 重置服務(wù)統(tǒng)計(jì)數(shù)據(jù) |
srvr | New in 3.3.0: Lists full details for the server. | |
stat | Lists brief details for the server and connected clients. | |
wchs | New in 3.3.0: Lists brief information on watches for the server. | |
wchc | New in 3.3.0: Lists detailed information on watches for the server, by session. This outputs a list of sessions(connections) with associated watches (paths). Note, depending on the number of watches this operation may be expensive (ie impact server performance), use it carefully. | |
wchp | New in 3.3.0: Lists detailed information on watches for the server, by path. This outputs a list of paths (znodes) with associated sessions. Note, depending on the number of watches this operation may be expensive (ie impact server performance), use it carefully. | |
mntr | New in 3.4.0: Outputs a list of variables that could be used for monitoring the health of the cluster. |
可能出現(xiàn)nc命令不存在的情況概作,如下:
[root@instance-e5cf5719 bin]# echo stat | nc localhost 2181
-bash: nc: command not found
在/usr/bin目錄中查看是否有nc命令,如沒有默怨,可按下面的方式進(jìn)行安裝:
[root@instance-e5cf5719 bin]# yum install -y nc
Loaded plugins: langpacks, versionlock
baidu-bcm | 1.2 kB 00:00:00
base | 3.6 kB 00:00:00
epel | 5.4 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/5): epel/x86_64/group_gz | 90 kB 00:00:00
(2/5): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(3/5): extras/7/x86_64/primary_db | 153 kB 00:00:00
(4/5): epel/x86_64/primary_db | 6.9 MB 00:00:00
(5/5): updates/7/x86_64/primary_db | 5.9 MB 00:00:00
Excluding 1 update due to versionlock (use "yum versionlock status" to show it)
Resolving Dependencies
--> Running transaction check
---> Package nmap-ncat.x86_64 2:6.40-19.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================================================================================
Installing:
nmap-ncat x86_64 2:6.40-19.el7 base 206 k
Transaction Summary
=====================================================================================================================================================================================================================================================
Install 1 Package
Total download size: 206 k
Installed size: 423 k
Downloading packages:
nmap-ncat-6.40-19.el7.x86_64.rpm | 206 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 2:nmap-ncat-6.40-19.el7.x86_64 1/1
Verifying : 2:nmap-ncat-6.40-19.el7.x86_64 1/1
Installed:
nmap-ncat.x86_64 2:6.40-19.el7
Complete!
做幾個測試:
[root@instance-e5cf5719 bin]# echo conf | nc localhost 2181
clientPort=2181
dataDir=/usr/zookeeper-3.4.14/data/version-2
dataLogDir=/usr/zookeeper-3.4.14/logs/version-2
tickTime=2000
maxClientCnxns=60
minSessionTimeout=4000
maxSessionTimeout=40000
serverId=1
initLimit=10
syncLimit=5
electionAlg=3
electionPort=3881
quorumPort=2881
peerType=0
[root@instance-e5cf5719 bin]# echo mntr | nc localhost 2181
zk_version 3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf, built on 03/06/2019 16:18 GMT
zk_avg_latency 0
zk_max_latency 0
zk_min_latency 0
zk_packets_received 3
zk_packets_sent 2
zk_num_alive_connections 1
zk_outstanding_requests 0
zk_server_state leader
zk_znode_count 11
zk_watch_count 0
zk_ephemerals_count 0
zk_approximate_data_size 189
zk_open_file_descriptor_count 33
zk_max_file_descriptor_count 65535
zk_fsync_threshold_exceed_count 0
zk_followers 2
zk_synced_followers 2
zk_pending_syncs 0
zk_last_proposal_size -1
zk_max_proposal_size -1
zk_min_proposal_size -1
5 總結(jié)
至此我們完成ZooKeeper單機(jī)版讯榕、偽集群和集群環(huán)境的搭建。在生產(chǎn)環(huán)境上為了確保ZooKeeper的高可用匙睹,務(wù)必要搭建集群環(huán)境愚屁。