0

我有一个使用标准虚拟机在 GCP 中运行的 3 节点 Cassandra (4.0.1) 集群。每台机器 2 个 CPU 8gb 内存。复制因子为 2 并使用简单的策略。我有一个插入数据的节点进程,Cassandra 将在没有可用连接或插入超时的情况下出错。峰值事务大约是 60/s,我对具有 1 个 CPU 和 4gb 的 Postgres 服务器进行完全相同的插入,没有问题。我增加了虚拟机的大小,但仍然存在问题。我读过的所有内容都表明它应该能够毫无问题地处理这个问题。我只创建一个连接。我使用准备好的语句。

There was a concurrent Cass error NoHostAvailableError: All host(s) tried for query failed. First host tried, 10.2.5.11:9042: Error: No connection available
    at HostConnectionPool.borrowConnection (/opt/hwws/node_modules/cassandra-driver/lib/host-connection-pool.js:106:13)
    at Host.borrowConnection (/opt/hwws/node_modules/cassandra-driver/lib/host.js:295:22)
    at RequestHandler.getNextConnection (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:99:27)
    at RequestHandler._startNewExecution (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:159:36)
    at /opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:138:42
    at DefaultLoadBalancingPolicy.newQueryPlan (/opt/hwws/node_modules/cassandra-driver/lib/policies/load-balancing.js:626:12)
    at /opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:132:13
    at new Promise (<anonymous>)
    at RequestHandler.send (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:119:12)
    at Function.send (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:64:21). See innerErrors.
    at RequestHandler.getNextConnection (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:81:15)
    at RequestHandler._startNewExecution (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:159:36)
    at /opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:138:42
    at DefaultLoadBalancingPolicy.newQueryPlan (/opt/hwws/node_modules/cassandra-driver/lib/policies/load-balancing.js:626:12)
    at /opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:132:13
    at new Promise (<anonymous>)
    at RequestHandler.send (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:119:12)
    at Function.send (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:64:21)
    at Client._execute (/opt/hwws/node_modules/cassandra-driver/lib/client.js:1016:31)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  info: 'Represents an error when a query cannot be performed because no host is available or could be reached by the driver.',
  innerErrors: {
    '10.2.5.11:9042': Error: No connection available
        at HostConnectionPool.borrowConnection (/opt/hwws/node_modules/cassandra-driver/lib/host-connection-pool.js:106:13)
        at Host.borrowConnection (/opt/hwws/node_modules/cassandra-driver/lib/host.js:295:22)
        at RequestHandler.getNextConnection (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:99:27)
        at RequestHandler._startNewExecution (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:159:36)
        at /opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:138:42
        at DefaultLoadBalancingPolicy.newQueryPlan (/opt/hwws/node_modules/cassandra-driver/lib/policies/load-balancing.js:626:12)
        at /opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:132:13
        at new Promise (<anonymous>)
        at RequestHandler.send (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:119:12)
        at Function.send (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:64:21),
    '10.2.5.12:9042': Error: No connection available
        at HostConnectionPool.borrowConnection (/opt/hwws/node_modules/cassandra-driver/lib/host-connection-pool.js:106:13)
        at Host.borrowConnection (/opt/hwws/node_modules/cassandra-driver/lib/host.js:295:22)
        at RequestHandler.getNextConnection (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:99:27)
        at RequestHandler._startNewExecution (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:159:36)
        at /opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:138:42
        at DefaultLoadBalancingPolicy.newQueryPlan (/opt/hwws/node_modules/cassandra-driver/lib/policies/load-balancing.js:626:12)
        at /opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:132:13
        at new Promise (<anonymous>)
        at RequestHandler.send (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:119:12)
        at Function.send (/opt/hwws/node_modules/cassandra-driver/lib/request-handler.js:64:21),
    '10.2.5.13:9042': Error: No connection available
    const client = new cassandra.Client({
  contactPoints: [process.env.CONTACTPOINTS],
  localDataCenter: process.env.DATACENTER,
  keyspace: process.env.KEYSPACE,
  pooling: {
    maxRequestsPerConnection: 8192
  }
});

我检查了日志,运行 nodetool 并找不到任何问题或配置问题。在这一点上,任何见解都会有所帮助。要清楚......大约 95% 的插入成功。

4

0 回答 0