【问题标题】:Couchbase cluster - exception when 1 node is downCouchbase 集群 - 1 个节点关闭时出现异常
【发布时间】:2013-12-30 14:22:43
【问题描述】:

我有一个包含 3 个节点的 Couchbase 集群。我有一个写入该集群的 java 进程。 当其中一个节点关闭时,我会收到此异常:

2013-12-30 14:03:23.259 WARN com.couchbase.client.CouchbaseConnection:  Node expected to receive data is inactive. This could be due to a failure within the cluster. Will check for updated configuration. Key without a configured node is: 980d330b2a96656a93bd08e48e6fc759135e6e6f.
Dec 30, 2013 2:03:23 PM com.couchbase.client.CouchbaseConnectionFactory resubConfigUpdate
INFO: Attempting to resubscribe for cluster config updates.
Dec 30, 2013 2:03:23 PM com.couchbase.client.CouchbaseConnectionFactory$Resubscriber run
INFO: Reconnect attempt 1, waiting 0ms
2013-12-30 14:03:24.020 INFO com.couchbase.client.CouchbaseConnection:  Reconnecting {QA sa=10.223.224.79/10.223.224.79:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0}
2013-12-30 14:03:24.261 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl:  Operation canceled because authentication or reconnection and authentication has taken more than one second to complete.
2013-12-30 14:03:24.263 WARN com.couchbase.client.CouchbaseConnection:  Node expected to receive data is inactive. This could be due to a failure within the cluster. Will check for updated configuration. Key without a configured node is: 980d330b2a96656a93bd08e48e6fc759135e6e6f.
2013-12-30 14:03:25.265 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl:  Operation canceled because authentication or reconnection and authentication has taken more than one second to complete.
441016302 [pool-5-thread-1] ERROR com.polimo.rtb.writer.CouchbaseWriter  - Error while trying to write to couchbase
java.util.concurrent.CancellationException: Cancelled
        at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:176)
        at net.spy.memcached.MemcachedClient.mutateWithDefault(MemcachedClient.java:1842)
        at net.spy.memcached.MemcachedClient.incr(MemcachedClient.java:1788)
        at com.polimo.rtb.writer.CouchbaseWriter.incrementCounterInDb(CouchbaseWriter.java:107)
        at com.polimo.rtb.writer.CouchbaseWriter.write(CouchbaseWriter.java:90)
        at com.polimo.rtb.consumer.ConsumerThread.run(ConsumerThread.java:40)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)

我正在使用standard java client,由于所描述的行为,我觉得我错过了使用集群的全部意义,我的意思是,如果一个节点出现故障,一切都应该正常工作。

是否缺少某些配置(服务器或客户端)?

【问题讨论】:

  • 您有哪些复制选项 - 如果您没有启用副本,那么丢失一个节点将意味着该节点上的数据不再可用,因此您将无法增加该节点文件。
  • 另外 - 你能发布你的代码摘录吗?
  • @DaveRigby 是正确的,如果一个节点发生故障,您要么必须将其故障转移到副本分区(自动或手动),要么如果您没有配置副本,那么哈希键进入故障节点上的分区将无法访问。
  • @DaveRigby 我应该遵循哪些复制选项?我应该在集群管理器中找到它吗?
  • @forhas:复制是基于每个存储桶设置的 - 有关详细信息,请参阅 docs.couchbase.com/couchbase-manual-2.2/…

标签: java couchbase


【解决方案1】:

复制是基于每个存储桶配置的。如果没有配置副本,那么当一个节点发生故障时,该节点托管的 vBucket 将不再可用,因此任何对该数据执行操作的尝试都会失败,如您所见。

有关配置副本的详细信息,请参阅 Couchbase 手册中的 Creating and Editing Data Buckets(特别是“创建存储桶”过程的副本部分和 Failover 节点部分)。

【讨论】:

  • 我已经为我的带有 2 个节点的存储桶启用了副本,但是我在使用 client.getBulk(keys) 时遇到了同样的错误。它适用于 client.get(key) 方法。
【解决方案2】:

您的客户端是如何配置的。您是否在配置中拥有所有集群节点的 IP 地址?如果您的配置中只有一个 IP 地址并且此节点崩溃,则您的应用程序无法访问您的集群。

【讨论】:

    猜你喜欢
    • 2012-02-09
    • 1970-01-01
    • 1970-01-01
    • 2021-08-18
    • 2016-10-19
    • 2015-05-23
    • 1970-01-01
    • 2017-06-03
    • 1970-01-01
    相关资源
    最近更新 更多