中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

redis cluster集群動態伸縮--刪除主從節點

發布時間:2020-06-02 21:24:32 來源:網絡 閱讀:806 作者:hgditren 欄目:關系型數據庫

目標:從集群中剔除一組主從(5007,5008)

經過上一節增加5007,5008主從服務節點后,目前集群的情況是這樣的:

b3363a81c3c59d57143cd3323481259c044e66d2 192.168.8.196:5006@15006 slave 1b7aa419065c5477c0def9d5e25106963fbdda76 0 1573003356000 3 connected
1b7aa419065c5477c0def9d5e25106963fbdda76 192.168.8.196:5003@15003 master - 0 1573003352829 3 connected 11089-16383
fbf9f23ecf0fea399debf7db42c73fece04b98fd 192.168.8.196:5005@15005 slave b1b67d4e554e29605bdbe40deab6670a42dd8836 0 1573003356842 2 connected
b1b67d4e554e29605bdbe40deab6670a42dd8836 192.168.8.196:5002@15002 master - 0 1573003355000 2 connected 5628-10922
d1a4b1aa3e924a5917efc240cdb2e3ada39e01c2 192.168.8.196:5001@15001 master - 0 1573003354837 1 connected 166-5460
9dc870942555447543694e42e40061823ed91271 192.168.8.196:5004@15004 slave d1a4b1aa3e924a5917efc240cdb2e3ada39e01c2 0 1573003357846 1 connected
63aa476d990dfa9f5f40eeeaa0315e7f9948554d 192.168.8.196:5007@15007 master - 0 1573003356000 7 connected 0-165 5461-5627 10923-11088
d3a9de370962873d17f1124bcf9ac166cc6ba950 192.168.8.196:5008@15008 myself,slave 63aa476d990dfa9f5f40eeeaa0315e7f9948554d 0 1573003350000 0 connected
序號 master node slave node
1 192.168.8.196:5001 192.168.8.196:5004
2 192.168.8.196:5002 192.168.8.196:5005
3 192.168.8.196:5003 192.168.8.196:5006
4 192.168.8.196:5007 192.168.8.196:5008

開始實施:
1.先移除 192.168.8.196:5008 從節點

redis-cli --cluster del-node 192.168.8.196:5008 d3a9de370962873d17f1124bcf9ac166cc6ba950

>> Removing node d3a9de370962873d17f1124bcf9ac166cc6ba950 from cluster 192.168.8.196:5008
>> Sending CLUSTER FORGET messages to the cluster...
>> SHUTDOWN the node.
>>

此時,192.168.8.196:5008 從節點已被刪除。

192.168.8.196:5001> cluster nodes
b3363a81c3c59d57143cd3323481259c044e66d2 192.168.8.196:5006@15006 slave 1b7aa419065c5477c0def9d5e25106963fbdda76 0 1573004309001 6 connected
9dc870942555447543694e42e40061823ed91271 192.168.8.196:5004@15004 slave d1a4b1aa3e924a5917efc240cdb2e3ada39e01c2 0 1573004310000 4 connected
1b7aa419065c5477c0def9d5e25106963fbdda76 192.168.8.196:5003@15003 master - 0 1573004311007 3 connected 11089-16383
b1b67d4e554e29605bdbe40deab6670a42dd8836 192.168.8.196:5002@15002 master - 0 1573004307000 2 connected 5628-10922
63aa476d990dfa9f5f40eeeaa0315e7f9948554d 192.168.8.196:5007@15007 master - 0 1573004307000 7 connected 0-165 5461-5627 10923-11088
fbf9f23ecf0fea399debf7db42c73fece04b98fd 192.168.8.196:5005@15005 slave b1b67d4e554e29605bdbe40deab6670a42dd8836 0 1573004310004 5 connected
d1a4b1aa3e924a5917efc240cdb2e3ada39e01c2 192.168.8.196:5001@15001 myself,master - 0 1573004308000 1 connected 166-5460
  1. 對192.168.8.196:5007 主節點從新分片,將5007上的分片轉移到其他節點

    $ redis-cli --cluster reshard 192.168.8.196:5007

會出現一下問答對話項

#需要移動數據槽的數量
How many slots do you want to move (from 1 to 16384)? 500
#需要接受數據槽的主節點ID,這里我們填寫5001號主服務節點ID
What is the receiving node ID? d1a4b1aa3e924a5917efc240cdb2e3ada39e01c2
#填寫數據槽來源節點
Please enter all the source node IDs.
  Type 'all' to use all the nodes as source nodes for the hash slots.
  Type 'done' once you entered all the source nodes IDs.
Source node #1: 63aa476d990dfa9f5f40eeeaa0315e7f9948554d
Source node #2: done

執行結束后,5007號主節點上的數據槽已經被轉移到5001號主節點上。此時,5007上沒有任何數據槽了。

b3363a81c3c59d57143cd3323481259c044e66d2 192.168.8.196:5006@15006 slave 1b7aa419065c5477c0def9d5e25106963fbdda76 0 1573004510000 6 connected
9dc870942555447543694e42e40061823ed91271 192.168.8.196:5004@15004 slave d1a4b1aa3e924a5917efc240cdb2e3ada39e01c2 0 1573004510589 8 connected
1b7aa419065c5477c0def9d5e25106963fbdda76 192.168.8.196:5003@15003 master - 0 1573004508000 3 connected 11089-16383
b1b67d4e554e29605bdbe40deab6670a42dd8836 192.168.8.196:5002@15002 master - 0 1573004510000 2 connected 5628-10922
63aa476d990dfa9f5f40eeeaa0315e7f9948554d 192.168.8.196:5007@15007 master - 0 1573004508000 7 connected
fbf9f23ecf0fea399debf7db42c73fece04b98fd 192.168.8.196:5005@15005 slave b1b67d4e554e29605bdbe40deab6670a42dd8836 0 1573004511594 5 connected
d1a4b1aa3e924a5917efc240cdb2e3ada39e01c2 192.168.8.196:5001@15001 myself,master - 0 1573004509000 8 connected 0-5627 10923-11088

3.最后一步,剔除192.168.8.196:5007

$ redis-cli --cluster del-node 192.168.8.196:5007 63aa476d990dfa9f5f40eeeaa0315e7f9948554d

>>> Removing node 63aa476d990dfa9f5f40eeeaa0315e7f9948554d from cluster 192.168.8.196:5007
>>> Sending CLUSTER FORGET messages to the cluster...
>>> SHUTDOWN the node.

4.5007,5008主從節點已被剔除,大功告成。

192.168.8.196:5001> cluster nodes
b3363a81c3c59d57143cd3323481259c044e66d2 192.168.8.196:5006@15006 slave 1b7aa419065c5477c0def9d5e25106963fbdda76 0 1573004592840 6 connected
9dc870942555447543694e42e40061823ed91271 192.168.8.196:5004@15004 slave d1a4b1aa3e924a5917efc240cdb2e3ada39e01c2 0 1573004591000 8 connected
1b7aa419065c5477c0def9d5e25106963fbdda76 192.168.8.196:5003@15003 master - 0 1573004591000 3 connected 11089-16383
b1b67d4e554e29605bdbe40deab6670a42dd8836 192.168.8.196:5002@15002 master - 0 1573004591838 2 connected 5628-10922
fbf9f23ecf0fea399debf7db42c73fece04b98fd 192.168.8.196:5005@15005 slave b1b67d4e554e29605bdbe40deab6670a42dd8836 0 1573004591000 5 connected
d1a4b1aa3e924a5917efc240cdb2e3ada39e01c2 192.168.8.196:5001@15001 myself,master - 0 1573004589000 8 connected 0-5627 10923-11088
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

河曲县| 额尔古纳市| 高密市| 密山市| 象山县| 余姚市| 延庆县| 天气| 南安市| 康保县| 岳池县| 兴国县| 临泽县| 汪清县| 叙永县| 买车| 泊头市| 德州市| 县级市| 新闻| 阿瓦提县| 介休市| 辽阳市| 南平市| 七台河市| 余姚市| 乌拉特中旗| 漳平市| 齐齐哈尔市| 常德市| 双鸭山市| 望都县| 永胜县| 屯昌县| 浙江省| 布尔津县| 齐河县| 永德县| 乾安县| 水城县| 涞水县|