zookeeper安裝解決

今天安裝配置三臺(tái)zookeeper服務(wù)集群,配置內(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=/var/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

server.1=192.168.249.97:2888:3888

server.2=192.168.249.157:2888:3888

server.1=192.168.249.187:2888:3888

安裝配置完畢后,逐一啟動(dòng)三臺(tái)服務(wù)器

(1)master

(2)slave0

(3)slave1

集群中三個(gè)zookeeper服務(wù)顯示正常啟動(dòng)。然后在master服務(wù)器使用的telnet 命令檢測(cè)集群工作狀態(tài),

[root@master bin]# telnet 127.0.0.1 2181

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

stat

This ZooKeeper instance is not currently serving requests

Connection closed by foreign host.

[root@master bin]# This ZooKeeper instance is not currently serving requestsUnable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect。

顯示集群無法進(jìn)行正常服務(wù),后使用zkCli客戶端進(jìn)行連接測(cè)試。

2018-06-08 23:05:37,441 [myid:] - INFO? [main-SendThread(localhost:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect

2018-06-08 23:05:38,673 [myid:] - INFO? [main-SendThread(localhost:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)

2018-06-08 23:05:38,674 [myid:] - INFO? [main-SendThread(localhost:2181):ClientCnxn$SendThread@878] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session

2018-06-08 23:05:38,677 [myid:] - INFO? [main-SendThread(localhost:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect

2018-06-08 23:05:39,571 [myid:] - INFO? [main-SendThread(localhost:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

2018-06-08 23:05:39,572 [myid:] - INFO? [main-SendThread(localhost:2181):ClientCnxn$SendThread@878] - Socket connection established to localhost/127.0.0.1:2181, initiating session

2018-06-08 23:05:39,576 [myid:] - INFO? [main-SendThread(localhost:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect

2018-06-08 23:05:41,349 [myid:] - INFO? [main-SendThread(localhost:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)

2018-06-08 23:05:41,351 [myid:] - INFO? [main-SendThread(localhost:2181):ClientCnxn$SendThread@878] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session

2018-06-08 23:05:41,352 [myid:] - INFO? [main-SendThread(localhost:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect

客戶端也顯示無法進(jìn)行正常的服務(wù)。

這種情況原因是集群沒有能夠選舉出Leader,在啟動(dòng)時(shí)正常已經(jīng)啟動(dòng)三個(gè)機(jī)器的zookeeper服務(wù),因此,可能是防火墻導(dǎo)致zookeeper服務(wù)端口無法進(jìn)行相互訪問。在集群中每臺(tái)機(jī)器中配置防火墻設(shè)置。

firewall-cmd --zone=public --add-port=2181/tcp --permanent

firewall-cmd --zone=public --add-port=2888/tcp --permanent

firewall-cmd --zone=public --add-port=3888/tcp --permanent

firewall-cmd --reload

逐次重新啟動(dòng),zookeeper,OK。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • ** 今天看了一下kafka官網(wǎng),嘗試著在自己電腦上安裝和配置,然后學(xué)一下官方document。** Introd...
    RainChang閱讀 5,154評(píng)論 1 30
  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,590評(píng)論 19 139
  • 1.配置java環(huán)境變量 這部分主要分為兩個(gè)內(nèi)容,一是卸載OpenJDK,二是安裝Sun JDK。 1.1卸載Op...
    9cain閱讀 1,987評(píng)論 0 1
  • 1、準(zhǔn)備 在分析探索Dubbo架構(gòu)原理之前,我們需要準(zhǔn)備一下環(huán)境,用于后面我們來分析dubbo的架構(gòu)。 1.1 Z...
    墨淵丶閱讀 2,735評(píng)論 1 20
  • 隨便翻看了下 大家寫的都非常漂亮!獻(xiàn)丑了獻(xiàn)丑了 默默地把今天的文章水掉了……
    黃小餅閱讀 349評(píng)論 0 2

友情鏈接更多精彩內(nèi)容