gpt4 book ai didi

多个集群的CouchbaseClient配置

转载 作者:行者123 更新时间:2023-12-04 00:33:29 25 4
gpt4 key购买 nike

假设我有两个带有 XDCR 设置并具有以下节点的 couchbase 集群:

n1.cluster1.com
n2.cluster1.com
n3.cluster1.com

n1.cluster2.com
n2.cluster2.com
n3.cluster2.com

CouchbaseClient 最好的节点配置是什么?

http://docs.couchbase.com/couchbase-sdk-java-1.4/#hello-couchbase 开始

The CouchbaseClient class accepts a list of URIs that point to nodes in the cluster. If your cluster has more than one node, Couchbase strongly recommends that you add at least two or three URIs to the list. The list does not have to contain all nodes in the cluster, but you do need to provide a few nodes so that during the initial connection phase your client can connect to the cluster even if one or more nodes fail.
After the initial connection, the client automatically fetches cluster configuration and keeps it up-to-date, even when the cluster topology changes. This means that you do not need to change your application configuration at all when you add nodes to your cluster or when nodes fail. Also make sure you use a URI in this format: http://[YOUR-NODE]:8091/pools. If you provide only the IP address, your client will fail to connect. We call this initial URI the bootstrap URI.

这是否意味着我应该从每个集群中至少添加两个或三个节点?还是整个系统中的两个或三个节点?

最佳答案

每个 CouchbaseClient 对象只会连接到一个集群。节点 URI 列表应该都属于同一个集群 - 如果您列出来自不同集群的节点,您可能会得到奇怪的行为。

如果您的应用程序想要连接到两个不同的集群(无论它们之间是否有复制流),那么您想要创建两个 CouchbaseClient 对象,一个连接到每个集群。

关于多个集群的CouchbaseClient配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26797968/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com