wiki:jazz/Cassandra

Version 5 (modified by jazz, 7 years ago) (diff)

--

Cassandra

CQL

  • 列出所有的 Keyspace
    cqlsh> DESCRIBE keyspaces;
    
  • 備份 A.A.A.A 整個 Cassandra 的 Schema
    root@cqlsh:~# cqlsh -e "DESC SCHEMA" A.A.A.A > /tmp/db_schema.cql 
    
  • 還原整個 Cassandra 的 Schema 到另一台 B.B.B.B 新的機器
    root@cqlsh:~# cqlsh B.B.B.B
    cqlsh> source '/tmp/db_schema.cql'
    
  • 查詢 Replication Factor
    cqlsh> SELECT keyspace_name,strategy_options FROM system.schema_keyspaces;
     
     keyspace_name | strategy_options
    ---------------+----------------------------
     system_traces | {"replication_factor":"2"}
    

NodeTool?

  • 查詢叢集節點狀態
    ~$ nodetool status
    
  • 強制移除故障節點
    ~$ nodetool removenode <HOST_ID>