Cassandra 1.2.0 叢集 刪除節點

來源:互聯網
上載者:User

一、說明

首先說明一下我的叢集部署情況:

在三台機器上部署了包含三個節點的叢集,通過nodetool查看到的資訊如所示

現在想刪除節點10.202.67.72,在該節點中建立過Keyspace20130101,其具體參數為

create keyspace Keyspace20130101 with placement_strategy='org.apache.cassandra.locator.SimpleStrategy' and strategy_options={replication_factor:1};

由於strategy_options={replication_factor:1},所以該keyspace只在節點10.202.67.72上有資料,刪除該節點將丟失這部分資料,所以在正式的部署環境中建議採用合適的副本策略。

二、刪除操作

1、down掉節點10.202.67.72------刪除節點之前必須把要刪除節點down掉,否則提示不能刪除本身

2、使用removenode移除已經斷開的節點:

      ./nodetool removenode <被移除的host id>

      查詢這個host id用命令:./nodetool status,如所示,節點10.202.67.72的host id是:0f57dc1e-e534-4f5f-8ff1-985538ce9691

 

3、完成上述刪除命令後可以查看到叢集狀態如下:ring上只有兩個節點,10.202.67.72已經被刪除

4、重新啟動節點10.202.67.72,然後查看狀態,發現此節點已經脫離上面的叢集,單獨組成了一個叢集

三、資料分析(基於副本策略)

      通過cassandra-cli訪問10.202.92.92和10.202.92.93節點群組成的叢集,發現還可以看到Keyspace20130101,並且可以用命令use Keyspace20130101進入Keyspace20130101,但是當訪問裡面的資料的時候,提示錯誤,不能正確訪問資料,出現這個現象的原因就是由於我們建立Keyspace20130101時設定strategy_options={replication_factor:1},這樣伴隨著Keyspace20130101的刪除資料也脫離了原來的叢集。

 

PS:歡迎大家繼續補充,補充更全面的情境

 

參考:http://blog.chinaunix.net/uid-20104120-id-3468254.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.