redis cluster 叢集重啟關閉樣本介紹

來源:互聯網
上載者:User


找遍了redis cluster官方文檔,沒發現有關叢集重啟和關閉的方法。為啥會沒有呢,猜測redis cluster至少要三個節點才能運行,三台同時掛掉的可能性比較小,只要不同時掛掉,掛掉的機器修複後在加入叢集,叢集都能良好的運作,萬一同時掛掉,資料又沒有備份的話,就有大麻煩了。

redis cluster叢集中的節點基本上都對等的,沒有管理節點。如果要讓所有節點都關閉,只能關閉進程了# pkill -9 redis
把所有叢集都關閉,然後在重新啟動,會報以下錯誤
# redis-trib.rb create --replicas 1 xxx.xxx.xxx.xxx:6379等 
會報以下錯誤,
[ERR] Node 192.168.10.219:6379 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

第一次啟動叢集時,/etc/redis下只有redis.conf,所以我想把除了redis.conf外的其他檔案全部刪除,在啟動肯定是可以的,但是叢集是有資料的,所以保留了設定檔和資料檔案。


# cd /etc/redis      
 
# rm -f *.aof nodes-63* 
 
# ll     //保留了設定檔和資料檔案 

總用量 204 
-rw-r--r-- 1 root root 18 5月 7 11:21 dump-6379.rdb 
-rw-r--r-- 1 root root 18 5月 7 11:21 dump-6380.rdb 
-rw-r--r-- 1 root root 18 5月 7 11:21 dump-6381.rdb 
-rw-r--r-- 1 root root 41412 4月 30 23:30 redis-6379.conf 
-rw-r--r-- 1 root root 41412 4月 30 23:39 redis-6380.conf 
-rw-r--r-- 1 root root 41412 4月 30 23:39 redis-6381.conf 

這樣是可以啟動的,但是原來的資料還是丟失了,不知道是自己的想法不對,還是redis cluster根本沒考慮,所有節點都會掛掉的情況。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.