如來神掌第三式第一招----ZOOKEEPER詳解


###############################################################################
# Name : Mahavairocana                                                                                                                                           
# Author : Mahavairocana                                                                                                                                         
# QQ : 10353512                                                                                                                                                     
# WeChat : shenlan-qianlan                                                                                                                                       
# Blog : http://www.cnblogs.com/Mahavairocana/                                                                                                        
# Description : You are welcome to reprint, or hyperlinks to indicate the source of the article, as well as author information.
###############################################################################

 

 

 

1、zookeeper: 協同工作,運行在內存中;

一個大型服務常常是由一系列子服務共同組成的。這些服務常常包含一系列動態的配置,以告知子服務當前程序運行環境的變化。那么我們需要怎樣完成配置的更新呢?這些配置的更改到底是由誰來發起?如果有多個發起方同時對同一配置進行更改,那么各個不同子服務接收到消息的先后順序將有所不同,進而導致各個子服務內部的動態配置互不相同。這一系列問題我們應該如何解決?

  答案就是我們要講解的ZooKeeper。ZooKeeper允許我們將數據組織成為一個類似於文件系統的數據結構。通過數據結點所在的地址,我們可以訪問數據結點中所包含的數據:

 


角色:
    Leader:領導 一個集群只能有一個Leader,分發任務等,Leader掛掉,Folloert會重新進行選舉;
    Follower:跟班,
    Client:訪問所有主機,需要有客戶端的類庫,可以位於集群內也可以不在集群,zk集群在內存中的數據結構是相同的;
    所有主機之間都需要通信,以便知道哪個服務器上線、下線;

存放數據結構:
    類似於linux文件系統
    /zk1
        /node1
    /zk2
        /node2


訪問過程
    1、客戶端可以連接到每個server,每個server的數據完全相同。
    2、每個follower都和leader有連接,接受leader的數據更新操作。
    3、Server記錄事務日志和快照到持久存儲。
    4、大多數server可用,整體服務就可用。
    5、Leader節點在接收到數據變更請求后,首先將變更寫入本地磁盤,以作恢復之用。當所有的寫請求持久化到磁盤以后,才會將變更應用到內存中。
    6、ZooKeeper使用了一種自定義的原子消息協議,在消息層的這種原子特性,保證了整個協調系統中的節點數據或狀態的一致性。Follower基於這種消息協議能夠保證本地的ZooKeeper數據與Leader節點同步,然后基於本地的存儲來獨立地對外提供服務。
    7、當一個Leader節點發生故障失效時,失敗故障是快速響應的,消息層負責重新選擇一個Leader,繼續作為協調服務集群的中心,處理客戶端寫請求,並將ZooKeeper協調系統的數據變更同步(廣播)到其他的Follower節點。


安裝

[root@localhost zookeeper]# wget http://archive.apache.org/dist/zookeeper/zookeeper-3.4.9/
[root@localhost zookeeper]# tar xf zookeeper-3.4.9.tar.gz
[root@localhost zookeeper]#  mkdir /usr/soft/
[root@localhost zookeeper]# mv zookeeper-3.4.9 /usr/soft/zookeeper
[root@localhost zookeeper]# cd /usr/soft/zookeeper/
[root@localhost zookeeper]# vim /etc/e
environment  ethers       event.d/     exports      
[root@localhost zookeeper]# cat /etc/environment
ZOOKEEPER_HOME=/usr/soft/zookeeper
JAVA_HOME=/usr/soft/java
HADOOP_INSTALL=/ust/soft/hadoop
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:
/root/bin:/usr/soft/zookeeper/bin"                                                                          
[root@localhost zookeeper]# source /etc/environment
[root@localhost zookeeper]# echo $ZOOKEEPER_HOME
/usr/soft/zookeeper
[root@localhost zookeeper]#

配置:
獨立模式:所有都在一台主機 (進程少)
偽分布模式:不同端口號
完全分布模式:端口可以相同,


[root@localhost conf]# cat zoo.cfg  #三台主機均為相同配置
# The number of milliseconds of each tick
tickTime=2000     #心跳周期,服務器之間通信(2秒)
# 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=/home/zookeeper   #存放數據目錄
# the port at which the clients will connect
clientPort=2181           #Server 提供供客戶端連接的端口
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60       #最大為60個鏈接,配置為0表示不限制
#
# 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
#
server.11=s1:2888:3888
server.12=s2:2888:3888
server.13=s3:2888:3888
# zk處理集群故障的算法是2n+1 最好在基數機器數部署
# 集群失效條件:小於等於半數服務器在線,表示服務器集群故障;

查看進程、端口

[root@master conf]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/soft/zookeeper/bin/../conf/zoo.cfg
Mode: leader
[root@master conf]# ps -ef | grep zo
root      2311     1  6 23:36 pts/0    00:00:01 java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /usr/soft/zookeeper/bin/../build/classes:/usr/soft/zookeeper/bin/../build/lib/*.jar:/usr/soft/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/soft/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/soft/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/usr/soft/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/soft/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/soft/zookeeper/bin/../zookeeper-3.4.9.jar:/usr/soft/zookeeper/bin/../src/java/lib/*.jar:/usr/soft/zookeeper/bin/../conf: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /usr/soft/zookeeper/bin/../conf/zoo.cfg
root      2376  2074  0 23:36 pts/0    00:00:00 grep zo
[root@master conf]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1366/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1444/master         
tcp        0      0 :::22                       :::*                        LISTEN      1366/sshd           
tcp        0      0 ::1:25                      :::*                        LISTEN      1444/master         
tcp        0      0 :::45307                    :::*                        LISTEN      2311/java           
tcp        0      0 :::2181                     :::*                        LISTEN      2311/java           
tcp        0      0 ::ffff:10.0.1.1:2888        :::*                        LISTEN      2311/java           
tcp        0      0 ::ffff:10.0.1.1:3888        :::*                        LISTEN      2311/java           

查看角色;

[root@master conf]#  zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/soft/zookeeper/bin/../conf/zoo.cfg
Mode: leader

[root@slave01 conf]#  zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/soft/zookeeper/bin/../conf/zoo.cfg
Mode: follower

[root@slave02 ~]#  zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/soft/zookeeper/bin/../conf/zoo.cfg
Mode: follower

切換角色  (master回復后,不會重新進行選舉,以當前運行為准;)

[root@master conf]# killall java
[root@master conf]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1366/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1444/master         
tcp        0      0 :::22                       :::*                        LISTEN      1366/sshd           
tcp        0      0 ::1:25                      :::*                        LISTEN      1444/master         


[root@slave01 conf]#  zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/soft/zookeeper/bin/../conf/zoo.cfg
Mode: follower


[root@slave02 ~]#  zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/soft/zookeeper/bin/../conf/zoo.cfg
Mode: leader

 

查看配置

遠程獲得server的信息
$>echo conf | nc ip 2181 === nc ip 2181 --> conf
conf    //配置信息
cons    //連接信息
dump    //未處理會話節點
envi    //環境信息
reqs    //未處理請求
ruok    //are you ok? imok
stat        //統計信息
wchs    //服務器watch的詳細信息
wchp    //列出指定路徑下的服務器信息



[root@slave02 ~]# echo conf | nc slave02 2181
clientPort=2181
dataDir=/tmp/zookeeper/version-2
dataLogDir=/tmp/zookeeper/version-2
tickTime=2000
maxClientCnxns=60
minSessionTimeout=4000
maxSessionTimeout=40000
serverId=3
initLimit=10
syncLimit=5
electionAlg=3
electionPort=3888
quorumPort=2888
peerType=0

[root@slave02 ~]# echo envi | nc slave02 2181    Environment:
zookeeper.version=3.4.9-1757313, built on 08/23/2016 06:50 GMT
host.name=slave02
java.version=1.8.0_161
java.vendor=Oracle Corporation
java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-3.b14.el6_9.x86_64/jre
java.class.path=/usr/soft/zookeeper/bin/../build/classes:/usr/soft/zookeeper/bin/../build/lib/*.jar:/usr/soft/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/soft/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/soft/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/usr/soft/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/soft/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/soft/zookeeper/bin/../zookeeper-3.4.9.jar:/usr/soft/zookeeper/bin/../src/java/lib/*.jar:/usr/soft/zookeeper/bin/../conf:
java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
java.io.tmpdir=/tmp
java.compiler=<NA>
os.name=Linux
os.arch=amd64
os.version=2.6.32-504.el6.x86_64
user.name=root
user.home=/root
user.dir=/root


[root@slave02 ~]# echo ruok | nc slave02 2181   ##查詢是否ok
imok[root@slave02 ~]# 

客戶端命令

客戶端命令:

通過客戶端腳本zkCli.sh連接到服務器
$>zkCli.sh -server s0:2181
//連接成功后如下信息
Welcome to ZooKeeper...
[...]help        //輸出幫助信息

通過客戶端腳本zkCli.sh連接到服務器
[...]ls /                //列出zk中包含的內容
[...]create /node1 helloworld    //創建/node1節點並指定
                                                   關聯字符串
[...]get /node1            //查詢節點數據
[...]set /node1 howareyou    //向節點寫入數據
[...]delete /node1         //刪除節點
[...]ls /                //列出根節點


通過客戶端腳本zkCli.sh連接到服務器
[ZooKeeper Stat Structure]
czxid    The zxid of the change that caused this znode to be created.
mzxi                    The zxid of the change that last modified this znode.
ctime    The time in milliseconds from epoch when this znode was created.
mtime    The time in milliseconds from epoch when this znode was last modified.
version    The number of changes to the data of this znode.
cversion           The number of changes to the children of this znode.
aversion           The number of changes to the ACL of this znode.
ephemeralOwner The session id of the owner of this znode if the znode is an  
                             ephemeral node. If it is not an ephemeral node, it will be zero.
dataLength       The length of the data field of this znode.
numChildren     The number of children of this znode.


[root@slave02 ~]# zkCli.sh -server slave02:2181
[zk: slave02:2181(CONNECTED) 0] h
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
[zk: slave02:2181(CONNECTED) 1] ls /
[zookeeper]
[zk: slave02:2181(CONNECTED) 4] ls /zookeeper
[quota]
[zk: slave02:2181(CONNECTED) 5] ls /zookeeper/quota
[]
[zk: slave02:2181(CONNECTED) 13] create /zookeeper test
Node already exists: /zookeeper
[zk: slave02:2181(CONNECTED) 14] create /zookeeper test1
Node already exists: /zookeeper
[zk: slave02:2181(CONNECTED) 15] create /root test      
Created /root

[zk: slave02:2181(CONNECTED) 20] get /root
test
cZxid = 0x400000006
ctime = Wed Jan 31 01:14:11 CST 2018
mZxid = 0x400000006
mtime = Wed Jan 31 01:14:11 CST 2018
pZxid = 0x400000006
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 4
numChildren = 0
[zk: slave02:2181(CONNECTED) 21] set /root test000
cZxid = 0x400000006
ctime = Wed Jan 31 01:14:11 CST 2018
mZxid = 0x400000007
mtime = Wed Jan 31 01:15:55 CST 2018
pZxid = 0x400000006
cversion = 0
dataVersion = 1  #數據每增加一次,版本增加一次;
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 7
numChildren = 0
[zk: slave02:2181(CONNECTED) 22]
[zk: slave02:2181(CONNECTED) 22] close
2018-01-31 01:20:37,452 [myid:] - INFO  [main:ZooKeeper@684] - Session: 0x36147c361070001 closed
[zk: slave02:2181(CLOSED) 23] 2018-01-31 01:20:37,455 [myid:] - INFO  [main-EventThread:ClientCnxn$EventThread@519] - EventThread shut down for session: 0x36147c361070001

 

 

踩坑

排錯日志: zookeeper.out,經過查看,為master 主機host加錯導致

[root@master conf]# cat zookeeper.out 
2018-01-30 23:33:01,792 [myid:] - INFO  [main:QuorumPeerConfig@124] - Reading configuration from: /usr/soft/zookeeper/bin/../conf/zoo.cfg
2018-01-30 23:33:01,867 [myid:] - INFO  [main:QuorumPeer$QuorumServer@149] - Resolved hostname: master to address: master/127.0.0.1
2018-01-30 23:33:01,868 [myid:] - INFO  [main:QuorumPeer$QuorumServer@149] - Resolved hostname: slave02 to address: slave02/10.0.3.1
2018-01-30 23:33:01,872 [myid:] - INFO  [main:QuorumPeer$QuorumServer@149] - Resolved hostname: slave01 to address: slave01/10.0.2.1
2018-01-30 23:33:01,873 [myid:] - INFO  [main:QuorumPeerConfig@352] - Defaulting to majority quorums
2018-01-30 23:33:01,887 [myid:1] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2018-01-30 23:33:01,888 [myid:1] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2018-01-30 23:33:01,889 [myid:1] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2018-01-30 23:33:01,928 [myid:1] - INFO  [main:QuorumPeerMain@127] - Starting quorum peer
2018-01-30 23:33:01,960 [myid:1] - INFO  [main:NIOServerCnxnFactory@89] - binding to port 0.0.0.0/0.0.0.0:2181
2018-01-30 23:33:01,981 [myid:1] - INFO  [main:QuorumPeer@1019] - tickTime set to 2000
2018-01-30 23:33:01,982 [myid:1] - INFO  [main:QuorumPeer@1039] - minSessionTimeout set to -1
2018-01-30 23:33:01,983 [myid:1] - INFO  [main:QuorumPeer@1050] - maxSessionTimeout set to -1
2018-01-30 23:33:01,984 [myid:1] - INFO  [main:QuorumPeer@1065] - initLimit set to 10
2018-01-30 23:33:02,038 [myid:1] - INFO  [ListenerThread:QuorumCnxManager$Listener@534] - My election bind port: master/127.0.0.1:3888
2018-01-30 23:33:02,070 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer@774] - LOOKING
2018-01-30 23:33:02,083 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@818] - New election. My id =  1, proposed zxid=0x0
2018-01-30 23:33:02,085 [myid:1] - INFO  [WorkerReceiver[myid=1]:FastLeaderElection@600] - Notification: 1 (message format version), 1 (n.leader), 0x0 (n.zxid), 0x1 (n.round), LOOKING (n.state), 1 (n.sid), 0x0 (n.peerEpoch) LOOKING (my state)
2018-01-30 23:33:02,097 [myid:1] - INFO  [WorkerSender[myid=1]:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (2, 1)
2018-01-30 23:33:02,098 [myid:1] - INFO  [WorkerSender[myid=1]:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (3, 1)
2018-01-30 23:33:02,299 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (2, 1)
2018-01-30 23:33:02,306 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (3, 1)
2018-01-30 23:33:02,306 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 400
2018-01-30 23:33:02,709 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (2, 1)
2018-01-30 23:33:02,711 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (3, 1)
2018-01-30 23:33:02,712 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 800
2018-01-30 23:33:03,513 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (2, 1)
2018-01-30 23:33:03,515 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (3, 1)
2018-01-30 23:33:03,517 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 1600
2018-01-30 23:33:05,120 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (2, 1)
2018-01-30 23:33:05,121 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (3, 1)
2018-01-30 23:33:05,122 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 3200
2018-01-30 23:33:08,331 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (2, 1)
2018-01-30 23:33:08,335 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (3, 1)
2018-01-30 23:33:08,336 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 6400
2018-01-30 23:33:09,348 [myid:1] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /127.0.0.1:45205
2018-01-30 23:33:09,361 [myid:1] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@827] - Processing srvr command from /127.0.0.1:45205
2018-01-30 23:33:09,375 [myid:1] - INFO  [Thread-1:NIOServerCnxn@1008] - Closed socket connection for client /127.0.0.1:45205 (no session established for client)
2018-01-30 23:33:14,738 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (2, 1)
2018-01-30 23:33:14,740 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (3, 1)
2018-01-30 23:33:14,740 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 12800
2018-01-30 23:33:27,542 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (2, 1)
2018-01-30 23:33:27,544 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (3, 1)
2018-01-30 23:33:27,544 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 25600
2018-01-30 23:33:53,146 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (2, 1)
2018-01-30 23:33:53,148 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (3, 1)
2018-01-30 23:33:53,150 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 51200
2018-01-30 23:34:44,352 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (2, 1)
2018-01-30 23:34:44,353 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@199] - Have smaller server identifier, so dropping the connection: (3, 1)
2018-01-30 23:34:44,354 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 60  0
2018-01-30 23:35:10,982 [myid:1] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /127.0.0.1:45214
2018-01-30 23:35:10,984 [myid:1] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@827] - Processing srvr command from /127.0.0.1:45214
2018-01-30 23:35:10,987 [myid:1] - INFO  [Thread-2:NIOServerCnxn@1008] - Closed socket connection for client /127.0.0.1:45214 (no session established for client)

 

 



myid: 文件位於datadir目錄下,只存放n


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM