如果您具有可以处理节点停机的复制因子和一致性级别,则可以在压缩期间从集群中删除该节点
nodetool disablebinary
nodetool disablethrift
这将阻止您的客户端应用程序发送请求并充当协调器,但它仍会接收来自写入的突变,因此它不会落后。如果你想进一步减少负载,你可以完全删除它
nodetool disablebinary
nodetool disablethrift
nodetool disablegossip
但请确保在 cassandra.yaml 中定义的 max_hint_window_in_ms 之前再次启用八卦(默认 3 小时)。如果您不这样做,该节点的提示将过期并且不会被传递,从而导致一致性问题,如果不进行修复将无法解决。
重新连接后,等待未决提示和活动提示降至 0,然后再次禁用 gossip。注意:pending 总是 +1,因为它有一个常规的计划任务,所以 1 不是零。
可以使用 OpsCenter、nodetool tpstats 或通过 JMX 使用 org.apache.cassandra.metrics:type=ThreadPools,path=internal,scope=HintedHandoff,name=PendingTasks 和 org.apache.cassandra.metrics:type=ThreadPools,path=internal,scope=HintedHandoff,name=ActiveTasks 检查提示线程池