您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)ZooKeeper怎么啟動(dòng),小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
ZooKeeper 是 Apache 軟件基金會(huì)的一個(gè)軟件項(xiàng)目,它為大型分布式計(jì)算提供開(kāi)源的分布式配置服務(wù)、同步服務(wù)和命名注冊(cè)ZooKeeper 的架構(gòu)通過(guò)冗余服務(wù)實(shí)現(xiàn)高可用性。Zookeeper 的設(shè)計(jì)目標(biāo)是將那些復(fù)雜且容易出錯(cuò)的分布式一致性服務(wù)封裝起來(lái),構(gòu)成一個(gè)高效可靠的原語(yǔ)集,并以一系列簡(jiǎn)單易用的接口提供給用戶(hù)使用。
ZooKeeper服務(wù)的啟動(dòng)方式分為三種,即單機(jī)模式、偽分布式模式、分布式模式,這里針對(duì)三種模式均做逐一講解。
Tips
調(diào)試過(guò)程建議盡量使用分布式模式,單機(jī)模式不推薦在生產(chǎn)環(huán)境下使用,偽分布式模式實(shí)質(zhì)上是在一個(gè)進(jìn)程內(nèi)派生多個(gè)線程模擬分布式形態(tài),由于操作系統(tǒng)的內(nèi)部結(jié)構(gòu)設(shè)計(jì),容易造成一些問(wèn)題,建議與其解決問(wèn)題不如切換到分布式模式。生產(chǎn)環(huán)境下建議一定采用分布式模式,如果機(jī)器不夠,推薦采用虛擬機(jī)方式。
采用單機(jī)模式,意味著只有一臺(tái)機(jī)器或者一個(gè)節(jié)點(diǎn),因此流程較為簡(jiǎn)單。首先,在conf目錄下面可以通過(guò)自己創(chuàng)建zoo.cfg文件的方式完成ZooKeeper的配置,如清單1-7所示,ZooKeeper服務(wù)會(huì)讀取該配置文件,具體的讀取代碼會(huì)在第四章介紹。
注意,ZooKeeper自帶了zoo_sample.cfg文件,這個(gè)是配置文件的模板文件,可以打開(kāi)看看具體的內(nèi)容,也可以作為zoo.cfg的創(chuàng)建內(nèi)容范例。
清單1-7 ZooKeeper配置文件
[root@localhost zookeeper-3.4.7]# cd conf[root@localhost conf]# ls -rlttotal 12 -rw-rw-r--. 1 1000 1000 922 Nov 1022:32 zoo_sample.cfg -rw-rw-r--. 1 1000 1000 2161 Nov 10 22:32 log4j.properties -rw-rw-r--. 1 1000 1000 535 Nov 1022:32 configuration.xsl [root@localhost conf]# cat zoo_sample.cfg# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial# synchronization phase can takeinitLimit=10# The number of ticks that can pass between# sending a request and getting an acknowledgementsyncLimit=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 connectclientPort=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
上面是自帶的示例配置,與我們相關(guān)的三個(gè)配置項(xiàng)是tickTime、dataDir和clientPort。
tickTime:這個(gè)參數(shù)主要是用來(lái)針對(duì)ZooKeeper服務(wù)端和客戶(hù)端的會(huì)話控制,包括心跳控制,一般來(lái)說(shuō),會(huì)話超時(shí)時(shí)間是該值的兩倍,它的單位是毫秒,我們?cè)O(shè)置為2000毫秒。
dataDir:這個(gè)目錄用來(lái)存放數(shù)據(jù)庫(kù)的鏡像和操作數(shù)據(jù)庫(kù)的日志。注意,如果這個(gè)文件夾不存在,需要手動(dòng)創(chuàng)建一個(gè)并賦予讀寫(xiě)權(quán)限,我們?cè)O(shè)置為/tmp/zookeeper,不用手動(dòng)創(chuàng)建這個(gè)文件夾,系統(tǒng)運(yùn)行后會(huì)自動(dòng)創(chuàng)建或覆蓋。
clientPort:ZooKeeper服務(wù)端監(jiān)聽(tīng)客戶(hù)端的端口,默認(rèn)是2181,這里沿用默認(rèn)設(shè)置。
接下來(lái)通過(guò)bin目錄下面的zkServer.sh腳本啟動(dòng)ZooKeeper服務(wù),如果不清楚具體參數(shù),可以直接調(diào)用腳本查看輸出,如清單1-8所示。
Tips
ZooKeeper采用的是Bourne Shell。Shell基本上是一個(gè)命令解釋器,類(lèi)似于DOS下的command。它接收用戶(hù)命令(如ls等),然后調(diào)用相應(yīng)的應(yīng)用程序。較為通用的shell有標(biāo)準(zhǔn)的Bourne shell、C shell和Korn shell。
清單1-8 調(diào)用zkServer.sh腳本
[root@localhost bin]# ./zkServer.shZooKeeper JMX enabled by default Using config: /home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../conf/zoo.cfg Usage: ./zkServer.sh{start|start-foreground|stop|restart|status|upgrade|print-cmd}
輸出中可以看到有start等選項(xiàng),具體每個(gè)選項(xiàng)的意義我們放在第四章解釋?zhuān)@里先啟動(dòng)ZooKeeper服務(wù),如清單1-9所示。
清單1-9 啟動(dòng)ZooKeeper
[root@localhost bin]# ./zkServer.sh startZooKeeper JMX enabled by default Using config:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../conf/zoo.cfg Starting zookeeper ... STARTED
ZooKeeper服務(wù)是否啟動(dòng)成功,可以通過(guò)ps或者jps命令查看,如清單1-10所示。
清單1-10 查看ZooKeeper服務(wù)
[root@localhost bin]# jps2737 QuorumPeerMain 2751 Jps [root@localhost bin]# ps -ef | grep zookeeper | grep -v grep | awk '{print$2}'2608
這里我們看到的進(jìn)程號(hào)為2737的進(jìn)程QuorumPeerMain代表了ZooKeeper服務(wù)。我們也可以通過(guò)ZooKeeper啟動(dòng)腳本自帶的參數(shù)“Status”來(lái)查看ZooKeeper進(jìn)程狀態(tài),如清單1-11所示。
清單1-11 查看ZooKeeper進(jìn)程狀態(tài)
[root@localhost bin]# ./zkServer.sh statusZooKeeper JMX enabled by default Using config:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../conf/zoo.cfg Mode: standalone
ZooKeeper服務(wù)運(yùn)行以后我們可以通過(guò)命令行工具去訪問(wèn)它,默認(rèn)是Java命令行腳本。我們可以通過(guò)以下命令方式啟動(dòng)ZooKeeper命令行Shell,運(yùn)行輸出如清單1-12所示。
清單1-12 ZKCli運(yùn)行輸出
[root@localhost bin]# ./zkCli.sh -server localhost:2181Connecting to localhost:2181 2015-12-20 23:22:10,620 [myid:] - INFO [main:Environment@100] - Clientenvironment:zookeeper.version=3.4.7-1713338, built on 11/09/2015 04:32 GMT 2015-12-20 23:22:10,645 [myid:] - INFO [main:Environment@100] - Client environment:host.name=localhost 2015-12-20 23:22:10,645 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_51 2015-12-20 23:22:10,657 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=OracleCorporation 2015-12-20 23:22:10,658 [myid:] - INFO [main:Environment@100] - Clientenvironment:java.home=/usr/lib/jdk1.8.0_51/jre 2015-12-20 23:22:10,658 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../build/classes:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../build/lib/*.jar:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../lib/slf4j-api-1.6.1.jar:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../lib/netty-3.7.0.Final.jar:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../lib/log4j-1.2.16.jar:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../lib/jline-0.9.94.jar:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../zookeeper-3.4.7.jar:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../src/java/lib/*.jar:/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin/../conf: 2015-12-20 23:22:10,660 [myid:] - INFO [main:Environment@100] - Clientenvironment:java.library.path=/usr/java/packages/lib/i386:/lib:/usr/lib 2015-12-20 23:22:10,665 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp 2015-12-20 23:22:10,665 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=2015-12-20 23:22:10,666 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux 2015-12-20 23:22:10,666 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=i386 2015-12-20 23:22:10,667 [myid:] - INFO [main:Environment@100] - Clientenvironment:os.version=2.6.32-504.el6.i686 2015-12-20 23:22:10,668 [myid:] - INFO [main:Environment@100] - Client environment:user.name=root 2015-12-20 23:22:10,668 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/root 2015-12-20 23:22:10,668 [myid:] - INFO [main:Environment@100] - Clientenvironment:user.dir=/home/zhoumingyao/zookeeper/zookeeper-3.4.7/bin 2015-12-20 23:22:10,693 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection,connectString=localhost:2181 sessionTimeout=30000watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@b07fd3 Welcome to ZooKeeper! 2015-12-20 23:22:10,953 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Openingsocket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt toauthenticate using SASL (unknown error) JLine support is enabled 2015-12-20 23:22:11,342 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@876] - Socketconnection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session 2015-12-20 23:22:11,672 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1299] - Sessionestablishment complete on server localhost/0:0:0:0:0:0:0:1:2181, sessionid =0x151c241c15b0000, negotiated timeout = 30000 WATCHER:: WatchedEvent state:SyncConnected type:None path:null [zk: localhost:2181(CONNECTED) 0]
光標(biāo)停留在[zk: localhost:2181(CONNECTED) 0]這一行,我們可以通過(guò)help請(qǐng)求來(lái)查看所有的支持命令,如清單1-13所示。
清單1-13 ZKCli help命令
[zk: localhost:2181(CONNECTED) 0] helpZooKeeper -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 dataacl addauth scheme auth quit getAcl path close connect host:port
關(guān)于ZKCli命令我們會(huì)在后續(xù)章節(jié)詳細(xì)解釋?zhuān)@里只做一個(gè)簡(jiǎn)單的演示,我們可以使用類(lèi)似于Linux的ls命令打印ZooKeeper內(nèi)部ZNode列表,如清單1-14所示。 清單1-14 打印ZNode列表
[zk: localhost:2181(CONNECTED) 1] ls / [zookeeper]
上面示例返回一個(gè)字符串zookeeper,這是一個(gè)ZooKeeper的ZNode(ZooKeeper術(shù)語(yǔ)),我們可以通過(guò)腳本創(chuàng)建一個(gè)ZNode,如清單1-15所示。
清單1-15 創(chuàng)建一個(gè)ZNode
[zk: localhost:2181(CONNECTED) 3] create /HelloWorld ""Created /HelloWorld [zk: localhost:2181(CONNECTED) 4] ls / [zookeeper, HelloWorld]
上面演示了如何啟動(dòng)單機(jī)模式,現(xiàn)在我們來(lái)演示設(shè)置偽分布式模式。
我們可以在一臺(tái)機(jī)器上創(chuàng)建模擬的ZooKeeper集群服務(wù),假如我們需要3個(gè)節(jié)點(diǎn),需要?jiǎng)?chuàng)建3個(gè)cfg文件,分別命名為zoo1.cfg,zoo2.cfg,zoo3.cfg,此外我們還需要?jiǎng)?chuàng)建3個(gè)不同的數(shù)據(jù)文件夾,分別是zoo1,zoo2和zoo3,目錄位于/var/lib/zookeeper,如1-16、1-17和1-18三個(gè)配置清單所示。
清單1-16 配置文件zoo1內(nèi)容
[root@localhost conf]# cat zoo1.cfg# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial# synchronization phase can takeinitLimit=10# The number of ticks that can pass between# sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just# example sakes.dataDir=/var/lib/zookeeper/zoo1# the port at which the clients will connectclientPort=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=1server.1=localhost:2666:3666 server.2=localhost:2667:3667 server.3=localhost:2668:3668
清單1-17 配置文件zoo2內(nèi)容
[root@localhost conf]# cat zoo2.cfg# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial# synchronization phase can takeinitLimit=10# The number of ticks that can pass between# sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just# example sakes.dataDir=dataDir=/var/lib/zookeeper/zoo2# the port at which the clients will connectclientPort=2182# 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=1server.1=localhost:2666:3666 server.2=localhost:2667:3667 server.3=localhost:2668:3668
清單1-18 配置文件zoo3內(nèi)容
[root@localhost conf]# cat zoo3.cfg# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial# synchronization phase can takeinitLimit=10# The number of ticks that can pass between# sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just# example sakes.dataDir=/var/lib/zookeeper/zoo3# the port at which the clients will connectclientPort=2183# 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=1server.1=localhost:2666:3666 server.2=localhost:2667:3667 server.3=localhost:2668:3668
注意,每一個(gè)虛擬機(jī)器都對(duì)應(yīng)一個(gè)自己的zoo{$}.cfg,其中的{$}需要通過(guò)清單1-19所示命令來(lái)進(jìn)行設(shè)置。
Tips
由于采用的是“>”,所以命令會(huì)創(chuàng)建文件,如果采用“>>”,則Linux會(huì)在原有文件基礎(chǔ)上新增內(nèi)容。
清單1-19 設(shè)置myid
[root@localhost conf]# echo 1 > /var/lib/zookeeper/zoo1/myid[root@localhost conf]# echo 2 > /var/lib/zookeeper/zoo2/myid[root@localhost conf]# echo 3 > /var/lib/zookeeper/zoo3/myid
接下來(lái)我們開(kāi)始啟動(dòng)ZooKeeper的3個(gè)實(shí)例(虛擬的3臺(tái)機(jī)器),需要調(diào)用三次zkServer.sh的Start命令,采用不同的配置文件,如清單1-20所示命令及輸出。
清單1-20 啟動(dòng)偽分布式集群服務(wù)
[root@localhost bin]# ./zkServer.sh start/home/zhoumingyao/zookeeper/zookeeper-3.4.7/conf/zoo1.cfgZooKeeper JMX enabled by default Using config: /home/zhoumingyao/zookeeper/zookeeper-3.4.7/conf/zoo1.cfg Starting zookeeper ... STARTED [root@localhost bin]# ./zkServer.sh start/home/zhoumingyao/zookeeper/zookeeper-3.4.7/conf/zoo2.cfgZooKeeper JMX enabled by default Using config: /home/zhoumingyao/zookeeper/zookeeper-3.4.7/conf/zoo2.cfg Starting zookeeper ... STARTED [root@localhost bin]# ./zkServer.sh start/home/zhoumingyao/zookeeper/zookeeper-3.4.7/conf/zoo3.cfgZooKeeper JMX enabled by default Using config: /home/zhoumingyao/zookeeper/zookeeper-3.4.7/conf/zoo3.cfg Starting zookeeper ... STARTED
清單1-21 查看服務(wù)
[root@localhost bin]# jps5537 QuorumPeerMain 5617 Jps 5585 QuorumPeerMain
確認(rèn)服務(wù)都正常啟動(dòng),我們就可以通過(guò)zkCli.sh腳本方式連接到ZooKeeper集群,命令為./zkCli.sh -server localhost:2181,localhost:2182,localhost:2183,效果和單機(jī)模式一樣。
由于ZooKeeper單機(jī)模式不支持單點(diǎn)失敗保護(hù),所以不推薦在生產(chǎn)環(huán)境下使用。
ZooKeeper有另外一種支持多臺(tái)機(jī)器的模式,即真正的分布式模式,這多臺(tái)包含在一個(gè)應(yīng)用體內(nèi)的集群機(jī)器被稱(chēng)為quorum,這些機(jī)器最小配置為3臺(tái),最佳配置為5臺(tái),其中包含1臺(tái)Leader(領(lǐng)導(dǎo)者)機(jī)器,由5臺(tái)機(jī)器內(nèi)部選舉產(chǎn)生,另外4臺(tái)機(jī)器就立即成為Follower(跟隨者)機(jī)器,一旦Leader宕機(jī),剩余的Follower就會(huì)重新選舉出Leader。
從配置文件內(nèi)部的字段定義上來(lái)說(shuō),分布式模式的ZooKeeper與單機(jī)模式的ZooKeeper有一些差距,例如下面三個(gè)字段:
Ø initLimit:follower對(duì)于Leader的初始化連接timeout時(shí)間; Ø syncLimit:follower對(duì)于Leader的同步timeout時(shí)間; Ø timeout的計(jì)算公式是initLimit*tickTime,syncLimit*tickTime。
此外,我們需要把組成quorum的所有機(jī)器也都列在這個(gè)配置文件里面。假設(shè)我們有兩個(gè)端口,第一個(gè)端口2889用于Follower和Leader之間的通信,通信方式是采用TCP方式,第二個(gè)端口3889是為選舉Leader用的,用于quorum內(nèi)部的Leader選舉響應(yīng)。那么我們配置文件如清單1-22所示。
清單1-22 分布式模式配置文件
server.1=node1:2889:3889 server.2=node2:2889:3889 server.3=node3:2889:3889
注意,分布式模式也需要設(shè)置myid,這個(gè)和偽分布式模式基本一樣,只需要在每一臺(tái)機(jī)器上實(shí)現(xiàn)一個(gè)myid,例如第一臺(tái)機(jī)器是1,第二臺(tái)機(jī)器上設(shè)置為2,第三臺(tái)機(jī)器上設(shè)置為3,以此類(lèi)推。
分布式模式的啟動(dòng)方式和單機(jī)唯一的差距是每一臺(tái)機(jī)器上都需要啟動(dòng)ZooKeeper服務(wù),即運(yùn)行命令./zkServer.sh start。
ZooKeeper服務(wù)端運(yùn)行后,我們可以通過(guò)在每臺(tái)機(jī)器上運(yùn)行./zkServer.sh status來(lái)查看選舉結(jié)果,其中Follower節(jié)點(diǎn)的運(yùn)行結(jié)果如清單所示,Leader節(jié)點(diǎn)的運(yùn)行結(jié)果如清單1-23所示。
清單1-23 Follower節(jié)點(diǎn)的運(yùn)行結(jié)果
[root@node3 bin]# ./zkServer.sh statusJMX enabled by default Using config: /usr/lib/zookeeper-3.4.6/bin/../conf/zoo.cfg Mode: follower
清單1-24 Leader節(jié)點(diǎn)的運(yùn)行結(jié)果
[root@node2 bin]# ./zkServer.sh statusJMX enabled by default Using config: /usr/lib/zookeeper-3.4.6/bin/../conf/zoo.cfg Mode: leader
差距就在于Mode這一欄。接下來(lái)可以通過(guò)zkCli命令行訪問(wèn)ZooKeeper服務(wù),假如我們?cè)L問(wèn)node2節(jié)點(diǎn),如清單1-25所示。
清單1-25 訪問(wèn)ZooKeeper服務(wù)及輸出
[root@localhost bin]# ./zkCli.sh -server node2:2182Connecting to node2:2182 2016-01-19 16:15:06,702 [myid:] - INFO [main:Environment@100] - Clientenvironment:zookeeper.version=3.4.7-1713338, built on 11/09/2015 04:32 GMT 2016-01-19 16:15:06,710 [myid:] - INFO [main:Environment@100] - Client environment:host.name=node2 2016-01-19 16:15:06,710 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.7.0_79 2016-01-19 16:15:06,714 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=OracleCorporation 2016-01-19 16:15:06,714 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/usr/lib/jdk1.7.0_79/jre 2016-01-19 16:15:06,715 [myid:] - INFO [main:Environment@100] - Clientenvironment:java.class.path=/home/zhoumingyao/zookeeper-3.4.7/bin/../build/classes:/home/zhoumingyao/zookeeper-3.4.7/bin/../build/lib/*.jar:/home/zhoumingyao/zookeeper-3.4.7/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/zhoumingyao/zookeeper-3.4.7/bin/../lib/slf4j-api-1.6.1.jar:/home/zhoumingyao/zookeeper-3.4.7/bin/../lib/netty-3.7.0.Final.jar:/home/zhoumingyao/zookeeper-3.4.7/bin/../lib/log4j-1.2.16.jar:/home/zhoumingyao/zookeeper-3.4.7/bin/../lib/jline-0.9.94.jar:/home/zhoumingyao/zookeeper-3.4.7/bin/../zookeeper-3.4.7.jar:/home/zhoumingyao/zookeeper-3.4.7/bin/../src/java/lib/*.jar:/home/zhoumingyao/zookeeper-3.4.7/bin/../conf:.:/usr/lib/jdk1.7.0_79/lib:/usr/lib/jdk1.7.0_79/jre/lib: 2016-01-19 16:15:06,715 [myid:] - INFO [main:Environment@100] - Clientenvironment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib 2016-01-19 16:15:06,715 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp 2016-01-19 16:15:06,715 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=2016-01-19 16:15:06,716 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux 2016-01-19 16:15:06,716 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64 2016-01-19 16:15:06,716 [myid:] - INFO [main:Environment@100] - Clientenvironment:os.version=3.10.0-123.el7.x86_64 2016-01-19 16:15:06,716 [myid:] - INFO [main:Environment@100] - Client environment:user.name=root 2016-01-19 16:15:06,717 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/root 2016-01-19 16:15:06,717 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/home/zhoumingyao/zookeeper-3.4.7/bin 2016-01-19 16:15:06,720 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection,connectString=node2:2182 sessionTimeout=30000watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@5dc6bb75 Welcome to ZooKeeper! 2016-01-19 16:15:06,774 [myid:] - INFO [main-SendThread(node2:2182):ClientCnxn$SendThread@1032] - Openingsocket connection to server node2/172.10.201.56:2182. Will not attempt toauthenticate using SASL (unknown error) 2016-01-19 16:15:06,783 [myid:] - INFO [main-SendThread(node2:2182):ClientCnxn$SendThread@876] - Socketconnection established to node2/172.10.201.56:2182, initiating session JLine support is enabled 2016-01-19 16:15:06,820 [myid:] - INFO [main-SendThread(node2:2182):ClientCnxn$SendThread@1299] - Sessionestablishment complete on server node2/172.10.201.56:2182, sessionid =0x25258f06e1f0000, negotiated timeout = 30000 WATCHER:: WatchedEvent state:SyncConnected type:None path:null [zk: node2:2182(CONNECTED) 0] helpZooKeeper -server host:port cmd args connect host:port get path [watch] ls path [watch] set path data [version] rmr path delquota [-n|-b] path quit printwatches on|off create [-s] [-e] path dataacl stat path [watch] close ls2 path [watch] history listquota path setAcl path acl getAcl path sync path redo cmdno addauth scheme auth delete path [version] setquota -n|-b val path [zk: node2:2182(CONNECTED) 1]
關(guān)于“ZooKeeper怎么啟動(dòng)”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。