Cassandra (9) nodetool

nodetool 常用指令:

選項 功能
status 顯示各節點狀態 (啟動狀態, IP, DC, Rack, Token num...)
ring 顯示每個節點負責的 Token 區間
tpstats 顯示 stagies 的資訊 (一個 task 會分成多個 stages,而 stages 在 thread pool 中執行)
tablestats 顯示 table 資訊
flush 將 memtable flush 到 SSTable
cleanup 清除非該節點的資料 (改變 token 分配時節點可能會持有非該節點的資料)
repair 修復資料的不一致性 (由於 consistency level 的設計,即便資料不一致讀寫仍可被視為成功)
decommission 將在線的節點除役並傳遞除役的資訊給其他節點 (除役不會刪除原本資料)
removenode 移除一個下線的節點
drain Flushes all memtables from the node to SSTables on disk. Cassandra stops listening for connections from the client and other nodes.
snapshot 建立快照
listsnapshots 顯示快照名單
clearsnapshot 清除快照

1. nodetool status:

用 nodetool status 分析一下我的叢集:

Datacenter: dc1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load        Tokens       Owns (effective)  Host ID                               Rack
UN  127.0.0.1  288.36 KiB  256          31.8%             a84bcf48-4683-4141-92b7-8b99b0f61edb  rack1
UN  192.0.0.2  404.12 KiB  256          31.3%             b85071dc-4d88-4183-9d78-920e961208fc  rack1
UN  192.0.0.3  417.49 KiB  256          36.9%             fff47680-518b-47f9-9dd2-d7f108e744d3  rack1
  1. 節點狀態: 節點狀態用兩個字母表示,第一個字母代表 U (up) or D (down),第二個字母代表 N (normal), L (leaving), J (joining), M (moving)
  2. Address: 節點 IP
  3. Load: 資料大小
  4. Tokens: Tokens 數
  5. Owns: Ring 負責範圍的百分比
  6. Rack: 所屬機架

2. nodetool ring:

用 nodetoool ring 觀察一下每個人的 Token 範圍:

Datacenter: dc1
==========
Address    Rack        Status State   Load            Owns                Token                                       
                                                                           9209105687517135177                         
127.0.0.1  rack1       Up     Normal  417.49 KiB      36.88%              -9195422962422523215                        
127.0.0.2  rack1       Up     Normal  417.49 KiB      36.88%              -9189567342144766392                        
127.0.0.3  rack1       Up     Normal  288.36 KiB      31.79%              -9155433180208108923                        

留言

熱門文章