当前 commitlog 目录指向 Directory1。我想将它更改为不同的目录 D2。应该如何迁移?
最佳答案
我们就是这样做的。我们有一个与 Cassandra 1.1.2 通信的负载均衡客户端,每个客户端都位于每个 Cassandra 节点上。
- 耗尽你的服务。
- 等待负载均衡器移除节点。
- 停止本地节点上的服务以停止直接 Client-Cassandra 写入:
systemctl stop <your service name>
- 此时应该没有更多的写入并且磁盘事件大大减少:
-
iostat 2
- 磁盘事件应该接近于零 -
nodetool gossipinfo
-
- 禁用 Cassandra gossip 协议(protocol)以将节点标记为已死亡并停止 Cassandra-Cassandra 写道:
nodetool disablegossip
- 将提交日志的所有内容刷新到 SSTables 中:
nodetool flush
- 清除节点——这个命令比 nodetool flush 更重要,(并且可能包括 nodetool flush 的所有行为):
nodetool drain
- 停止 cassandra 进程:
systemctl stop cassandra
- 修改 Cassandra 配置文件,例如
vi /etc/cassandra/default.conf/cassandra.yaml
- 启动 Cassandra:
systemctl start cassandra
- 等待 10-20 分钟。跟踪 Cassandra 日志以跟进,例如
tail -F /var/log/cassandra/system.log
- 在移动到下一个节点之前确认环是健康的:
nodetool ring
- 重新启动客户端服务:
systemctl start <your service here>
请注意,我们不需要自己手动复制提交日志文件。冲洗和排水解决了这个问题。然后这些文件慢慢地重新出现在新的 commitlog_dir
中。位置。
关于cassandra - 更改cassandra中的commitlog目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42062062/