多节点cassandra设置+连接出错

问题描述 投票:0回答:1

所以我正在尝试设置多节点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秒,然后就死了。有时它会在之前运行成功的查询中死亡。另外,我只是想知道,为什么它说2个失败,如果有3个节点(一个种子节点)?

我注意到,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后,我向数据库运行了一个写入查询,并在所有三个节点上填充了数据。

任何解决这两个错误的帮助都会很精彩!

express cassandra cassandra-3.0 express-cassandra
1个回答
1
投票

在这里提供答案,以防万一其他人挣扎。

这个问题与NetworkTopologyStrategy有关。我切换到SimpleStrategy,它开始工作了。

我只有一个DC。

不确定,究竟是什么导致了这个问题,但如果有人知道,请随意将其添加到评论中,我会更新答案。

© www.soinside.com 2019 - 2024. All rights reserved.