scylladb下线数据中心
1、在要下线的老数据中心所有节点运行数据修复
nodetool -h ::FFFF:127.0.0.1 repair -pr
2、更改所有业务keyspace的复制策略不在写入老的数据中心
--查看所有的keyspaces
[root@172-16-121-151 ~]# cqlsh 172.16.121.151
Connected to dtstack at 172.16.121.151:9042.
[cqlsh 5.0.1 | Cassandra 3.0.8 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
cqlsh> describe keyspaces;
案例:
更改前:
cqlsh> desc test;
CREATE KEYSPACE test WITH replication = {'class': 'NetworkTopologyStrategy', 'my_data_center': '3', 'my_data_center1': '3'} AND durable_writes = true;
更改为新中心多副本:
ALTER KEYSPACE test WITH replication = {'class':'NetworkTopologyStrategy', 'my_data_center1' : '3'};
更改后:
cqlsh> desc test;
CREATE KEYSPACE test WITH replication = {'class': 'NetworkTopologyStrategy', 'my_data_center1': '3'} AND durable_writes = true;
3、删除节点
nodetool -h ::FFFF:127.0.0.1 decommission
4、验证集群状态
--观察下线数据传输进度
iftop
nodetool -h ::FFFF:127.0.0.1 netstats
--传输完成后验证集群状态
nodetool -h ::FFFF:127.0.0.1 status
5、数据删除
从集群中删除节点时,不会自动删除其数据。您需要手动删除数据以确保它不再计入该节点上的负载。使用以下命令删除数据(此步骤可以不执行)
sudo rm -rf /var/lib/scylla/data
sudo find /var/lib/scylla/commitlog -type f -delete
sudo find /var/lib/scylla/hints -type f -delete
sudo find /var/lib/scylla/view_hints -type f -delete