cassandra 操作记录

查看状态

bin/nodetool status

查看所有的 keyspaces

DESCRIBE KEYSPACES

查看网络状态

bin/nodetool netstats

查看 gossipinfo

bin/nodetool gossipinfo

修改 replication factor 之后进行 repair

bin/nodetool repair

踢除一个活的节点

bin/nodetool decommision

导出一个 keyspace 的结构

cqlsh -e "DESC KEYSPACE test" > db_schema_test.cql;

导出所有 keyspace 的结构

cqlsh -e "DESC SCHEMA" > db_schema.cql

导出表至 csv 文件

COPY table_name ( column , ... )
TO  'file_name' | STDOUT 
WITH option = 'value' AND ...

当需要维护一个结点时

cd /opt/platform/cassandra/
bin/nodetool drain
# stop
pgrep -u ops -f cassandra | xargs kill -9

# start
nohup ./bin/cassandra &

变更后 Check
/opt/platform/cassandra/bin/nodetool status
关注

Status – U (up) or D (down)
Indicates whether the node is functioning or not.

State – N (normal), L (leaving), J (joining), M (moving)
The state of the node in relation to the cluster.

留下评论

电子邮件地址不会被公开。 必填项已用*标注