所以我正在尝试设置多节点 cassandra 集群。
我在 3 个不同的服务器上设置了 3 个 cassandra 节点。在所有三个 cassandra.yaml 文件中,我都定义了同一个种子节点。清除数据并一一重新启动服务后,我可以看到它们出现了,并且nodetool状态显示所有条目的UN。现在我使用 express-cassandra 连接到 cassandra,它工作得很好,但它只适用于前几个查询,之后,它只是崩溃并出现以下错误 -
Error during find query on DB -> ResponseError: Server failure during read query at consistency ONE (1 responses were required but only 0 replicas responded, 2 failed)
它在哪个读取查询上失败并不重要,但它会持续 10 秒然后它就死了。有时它会在上次运行成功的查询上死掉。另外,我只是想知道,如果有 3 个节点(一个种子节点),为什么它说 2 失败?
我注意到,express-cassandra 通知复制因子已更改并运行 nodetool 修复,但我不断收到以下错误消息 -
Validation failed in /xxx.xxx.xxx.xxx (progress: 0%)
[2018-07-02 08:10:33,447] Some repair failed
xxx.xxx.xxx.xxx
三个节点 IP 地址之一在哪里。我尝试在每个节点上运行 nodetool 修复,但我在每个服务器上不断收到相同的错误。
这些是我的 express-cassandra 设置属性(xxx.xxx.xxx.xxx 是我的种子 IP 地址):
clientOptions: {
contactPoints: ['xxx.xxx.xxx.xxx'],
protocolOptions: {
port: 9042
},
keyspace: 'test_keyspace',
queryOptions: {
consistency: cassandra.consistencies.one
},
socketOptions: {
readTimeout: 0
}
},
ormOptions: {
defaultReplicationStrategy: {
class: 'NetworkTopologyStrategy',
dc1: 3
}
}
我不确定 NetworkTOpologyStrategy 是否设置正确,但在启动 express.js 后,我对数据库运行了一个写入查询,它在所有三个节点上填充了数据。
解决这两个错误的任何帮助都会很棒!