這期內(nèi)容當中小編將會給大家?guī)碛嘘P(guān)ZooKeeper注冊中心重啟后會對Dubbo服務(wù)發(fā)布/訂閱造成什么影響,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
創(chuàng)新互聯(lián)公司長期為上1000+客戶提供的網(wǎng)站建設(shè)服務(wù),團隊從業(yè)經(jīng)驗10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為泉港企業(yè)提供專業(yè)的網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計,泉港網(wǎng)站改版等技術(shù)服務(wù)。擁有十多年豐富建站經(jīng)驗和眾多成功案例,為您定制開發(fā)。
情況:ZooKeeper集群刪除所有數(shù)據(jù),重啟ZooKeeper集群后,im-service沒有providers,
重啟im-service后,im-service所有dubbo接口沒有consumers。
重啟im-web之后,一切ok。
問題:如果dubbo服務(wù)運行正常,但是ZooKeeper集群宕機,并且丟失了所有的數(shù)據(jù)。 ZooKeeper集群重啟后,需要重啟dubbo服務(wù)嗎? 答案:需要的。 ------------------------------------------------------------- 問題:如果dubbo服務(wù)運行正常,但是ZooKeeper集群宕機,沒有丟失任何數(shù)據(jù)(zk數(shù)據(jù)做了持久化)。 ZooKeeper集群重啟后,需要重啟dubbo服務(wù)嗎? 答案:不需要的。
ZooKeeper 3.4.11
dubbo 2.5.3
1、在docker容器中,啟動ZooKeeper集群
2、在本地啟動gwy-res-web項目。
此項目既是provider又是consumer:
此時在ZooKeeper中看到:
[zk: localhost:2181(CONNECTED) 1] ls /dubbo [com.newbanker.ie.service.CourseService, io.newbanker.modules.sys.service.ExhibitionCenterConfigService, com.newbanker.gwy.res.dubbo.service.ResAdRpcService, com.newbanker.mq.rely.service.MessageSenderService, com.newbanker.gwy.res.dubbo.service.GwyResCourseService, com.newbanker.gwy.res.dubbo.service.MarketingActivityAuthorizeService]
3、停止所有ZooKeeper,并刪除所有ZooKeeper容器。之后重新建立ZooKeeper容器并啟動:
[root@localhost ~]# docker stop `docker ps -q` ## 停止所有ZooKeeper服務(wù) 59533a8fa961 c8836b1a0da7 f1a194bedd53 [root@localhost ~]# docker rm `docker ps -qa` ## 刪除所有ZooKeeper容器 59533a8fa961 c8836b1a0da7 f1a194bedd53 [root@localhost ~]# docker-compose -f zookeeper-compose.yml up -d ##重新創(chuàng)建ZooKeeper容器并啟動 Creating zk1_cname ... done Creating zk2_cname ... done Creating zk3_cname ... done [root@localhost ~]# docker ps -aq ##查看新建容器id b73250197d7d 263d6efaa028 346334a5513f [root@localhost ~]# docker exec -it zk1_cname sh ##進入一個容器中 /zookeeper-3.4.11/bin # ./bin/zkCli.sh ##在容器中使用zk客戶端鏈接服務(wù)端。 Connecting to localhost:2181 2019-09-19 09:03:46,773 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.11-37e277162d567b55a07d1755f0b31c32e93c01a0, built on 11/01/2017 18:06 GMT 這里省略一些ZooKeeper客戶端鏈接ZooKeeper server的日志。 WATCHER:: WatchedEvent state:SyncConnected type:None path:null [zk: localhost:2181(CONNECTED) 0] ls / ##查看ZooKeeper節(jié)點,可以看到,并沒有/dubbo節(jié)點!?。? [zookeeper]
5、gwy-res-web一直在打日志如下。并且根據(jù)上一步:在zk中使用 ls / 命令,在zk跟節(jié)點下,并沒有/dubbo節(jié)點。說明服務(wù)并沒有重新注冊到zk。
2019-09-19 17:12:39.677 [main-SendThread(192.168.126.129:2183)] INFO org.apache.zookeeper.ClientCnxn:1158 - Unable to read additional data from server sessionid 0x2000001648c0000, likely server has closed socket, closing socket connection and attempting reconnect 2019-09-19 17:12:40.706 [main-SendThread(192.168.126.129:2182)] INFO org.apache.zookeeper.ClientCnxn:1032 - Opening socket connection to server 192.168.126.129/192.168.126.129:2182. Will not attempt to authenticate using SASL (unknown error) 2019-09-19 17:12:40.707 [main-SendThread(192.168.126.129:2182)] INFO org.apache.zookeeper.ClientCnxn:876 - Socket connection established to 192.168.126.129/192.168.126.129:2182, initiating session 2019-09-19 17:12:40.709 [main-SendThread(192.168.126.129:2182)] INFO org.apache.zookeeper.ClientCnxn:1158 - Unable to read additional data from server sessionid 0x2000001648c0000, likely server has closed socket, closing socket connection and attempting reconnect 2019-09-19 17:12:42.239 [main-SendThread(192.168.126.129:2181)] INFO org.apache.zookeeper.ClientCnxn:1032 - Opening socket connection to server 192.168.126.129/192.168.126.129:2181. Will not attempt to authenticate using SASL (unknown error) 2019-09-19 17:12:42.240 [main-SendThread(192.168.126.129:2181)] INFO org.apache.zookeeper.ClientCnxn:876 - Socket connection established to 192.168.126.129/192.168.126.129:2181, initiating session 2019-09-19 17:12:42.242 [main-SendThread(192.168.126.129:2181)] INFO org.apache.zookeeper.ClientCnxn:1158 - Unable to read additional data from server sessionid 0x2000001648c0000, likely server has closed socket, closing socket connection and attempting reconnect 2019-09-19 17:12:43.310 [main-SendThread(192.168.126.129:2183)] INFO org.apache.zookeeper.ClientCnxn:1032 - Opening socket connection to server 192.168.126.129/192.168.126.129:2183. Will not attempt to authenticate using SASL (unknown error) 2019-09-19 17:12:43.312 [main-SendThread(192.168.126.129:2183)] INFO org.apache.zookeeper.ClientCnxn:876 - Socket connection established to 192.168.126.129/192.168.126.129:2183, initiating session 2019-09-19 17:12:43.314 [main-SendThread(192.168.126.129:2183)] INFO org.apache.zookeeper.ClientCnxn:1158 - Unable to read additional data from server sessionid 0x2000001648c0000, likely server has closed socket, closing socket connection and attempting reconnect 2019-09-19 17:12:43.861 [main-SendThread(192.168.126.129:2182)] INFO org.apache.zookeeper.ClientCnxn:1032 - Opening socket connection to server 192.168.126.129/192.168.126.129:2182. Will not attempt to authenticate using SASL (unknown error) 2019-09-19 17:12:43.863 [main-SendThread(192.168.126.129:2182)] INFO org.apache.zookeeper.ClientCnxn:876 - Socket connection established to 192.168.126.129/192.168.126.129:2182, initiating session 2019-09-19 17:12:43.864 [main-SendThread(192.168.126.129:2182)] INFO org.apache.zookeeper.ClientCnxn:1158 - Unable to read additional data from server sessionid 0x2000001648c0000, likely server has closed socket, closing socket connection and attempting reconnect 2019-09-19 17:12:44.971 [main-SendThread(192.168.126.129:2181)] INFO org.apache.zookeeper.ClientCnxn:1032 - Opening socket connection to server 192.168.126.129/192.168.126.129:2181. Will not attempt to authenticate using SASL (unknown error) 2019-09-19 17:12:44.971 [main-SendThread(192.168.126.129:2181)] INFO org.apache.zookeeper.ClientCnxn:876 - Socket connection established to 192.168.126.129/192.168.126.129:2181, initiating session 2019-09-19 17:12:44.973 [main-SendThread(192.168.126.129:2181)] INFO org.apache.zookeeper.ClientCnxn:1158 - Unable to read additional data from server sessionid 0x2000001648c0000, likely server has closed socket, closing socket connection and attempting reconnect 2019-09-19 17:12:45.845 [main-SendThread(192.168.126.129:2183)] INFO org.apache.zookeeper.ClientCnxn:1032 - Opening socket connection to server 192.168.126.129/192.168.126.129:2183. Will not attempt to authenticate using SASL (unknown error) 2019-09-19 17:12:45.846 [main-SendThread(192.168.126.129:2183)] INFO org.apache.zookeeper.ClientCnxn:876 - Socket connection established to 192.168.126.129/192.168.126.129:2183, initiating session 2019-09-19 17:12:45.848 [main-SendThread(192.168.126.129:2183)] INFO org.apache.zookeeper.ClientCnxn:1158 - Unable to read additional data from server sessionid 0x2000001648c0000, likely server has closed socket, closing socket connection and attempting reconnect 2019-09-19 17:12:46.207 [main-SendThread(192.168.126.129:2182)] INFO org.apache.zookeeper.ClientCnxn:1032 - Opening socket connection to server 192.168.126.129/192.168.126.129:2182. Will not attempt to authenticate using SASL (unknown error) 2019-09-19 17:12:46.208 [main-SendThread(192.168.126.129:2182)] INFO org.apache.zookeeper.ClientCnxn:876 - Socket connection established to 192.168.126.129/192.168.126.129:2182, initiating session 2019-09-19 17:12:46.209 [main-SendThread(192.168.126.129:2182)] INFO org.apache.zookeeper.ClientCnxn:1158 - Unable to read additional data from server sessionid 0x2000001648c0000, likely server has closed socket, closing socket connection and attempting reconnect 2019-09-19 17:12:48.081 [main-SendThread(192.168.126.129:2181)] INFO org.apache.zookeeper.ClientCnxn:1032 - Opening socket connection to server 192.168.126.129/192.168.126.129:2181. Will not attempt to authenticate using SASL (unknown error) 2019-09-19 17:12:48.082 [main-SendThread(192.168.126.129:2181)] INFO org.apache.zookeeper.ClientCnxn:876 - Socket connection established to 192.168.126.129/192.168.126.129:2181, initiating session 2019-09-19 17:12:48.084 [main-SendThread(192.168.126.129:2181)] INFO org.apache.zookeeper.ClientCnxn:1158 - Unable to read additional data from server sessionid 0x2000001648c0000, likely server has closed socket, closing socket connection and attempting reconnect 2019-09-19 17:12:48.847 [main-SendThread(192.168.126.129:2183)] INFO org.apache.zookeeper.ClientCnxn:1032 - Opening socket connection to server 192.168.126.129/192.168.126.129:2183. Will not attempt to authenticate using SASL (unknown error) 2019-09-19 17:12:48.848 [main-SendThread(192.168.126.129:2183)] INFO org.apache.zookeeper.ClientCnxn:876 - Socket connection established to 192.168.126.129/192.168.126.129:2183, initiating session 2019-09-19 17:12:48.850 [main-SendThread(192.168.126.129:2183)] INFO org.apache.zookeeper.ClientCnxn:1158 - Unable to read additional data from server sessionid 0x2000001648c0000, likely server has closed socket, closing socket connection and attempting reconnect
6、結(jié)論:也就是說,整個ZooKeeper集群宕機并丟失所有數(shù)據(jù)后,重啟ZooKeeper集群,此時需要重啟業(yè)務(wù)系統(tǒng)。
而當整個ZooKeeper集群宕機,但是沒有丟失數(shù)據(jù)時,重啟ZooKeeper集群后不用重啟業(yè)務(wù)系統(tǒng)。(因為ZooKeeper服務(wù)端存儲的數(shù)據(jù)包含了服務(wù)端和客戶端之間session信息。)
dubbo服務(wù)會自動探測ZooKeeper運行狀態(tài),當ZooKeeper可用后,providers會把服務(wù)發(fā)布到ZooKeeper注冊中心,consumers也會訂閱ZooKeeper注冊中心。
上述就是小編為大家分享的ZooKeeper注冊中心重啟后會對Dubbo服務(wù)發(fā)布/訂閱造成什么影響了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
文章標題:ZooKeeper注冊中心重啟后會對Dubbo服務(wù)發(fā)布/訂閱造成什么影響
文章轉(zhuǎn)載:http://aaarwkj.com/article34/igehse.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、網(wǎng)站排名、用戶體驗、虛擬主機、Google、動態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)