wiki:jazz/Cassandra

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>
    
Last modified 7 years ago Last modified on Jan 24, 2018, 12:22:10 PM