【问题标题】:Couchbase Connection - External ip instead of internalCouchbase 连接 - 外部 ip 而不是内部
【发布时间】:2014-07-28 13:32:51
【问题描述】:

在同一个数据中心,我有一个应用服务器(客户端)连接到一个包含 3 个节点的 couchbase 集群。

我希望客户端通过内部 IP 而不是外部 IP 进行连接以优化性能。 假设这些是我的 IP:

  • node1InternalIP / node1ExternalIP
  • node2InternalIP / node2ExternalIP
  • node3InternalIP / node3ExternalIP

在创建我的 couchbase 客户端(java 代码)时,我提供了我的内部 IP,但在建立连接后,我得到了这些日志:

2014-07-28 12:33:21.030 INFO net.spy.memcached.auth.AuthThread:  Authenticated to /node1InternalIP :11210
2014-07-28 12:33:21.142 INFO net.spy.memcached.auth.AuthThread:  Authenticated to /node2InternalIP :11210
2014-07-28 12:33:21.253 INFO net.spy.memcached.auth.AuthThread:  Authenticated to /node3InternalIP :11210
2014-07-28 12:33:21.374 INFO com.couchbase.client.vbucket.provider.BucketConfigurationProvider:  Carrier config not available, bootstrapped through HTTP.
2014-07-28 12:33:21.544 INFO com.couchbase.client.CouchbaseConnection:  Added {QA sa=cache2.lac.company.info/node1ExternalIP:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2014-07-28 12:33:21.545 INFO com.couchbase.client.CouchbaseConnection:  Added {QA sa=cache3.lac.company.info/node2ExternalIP:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2014-07-28 12:33:21.545 INFO com.couchbase.client.CouchbaseConnection:  Added {QA sa=cache4.lac.company.info/node3ExternalIP:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue

看来,身份验证是针对内部 IP 完成的,但连接本身是通过外部 IP 进行的——这让我很担心。

此外,有时我会收到 CheckedOperationTimeoutException:

net.spy.memcached.internal.CheckedOperationTimeoutException: Timed out waiting for operation - failing node: cache2.lac.company.info/node1ExternalIP:11210

异常表明客户端从外部 ip 连接超时。

如何确保我的连接将使用内部 IP?

【问题讨论】:

    标签: java couchbase dbconnection


    【解决方案1】:

    Couchbase 使用单个地址(IP 或主机名)来标识每个集群节点。然后在引导时将这些地址发送给客户端,以便它们可以连接到集群中的所有节点。您所看到的将是由于您最初使用外部 IP 地址作为名称设置集群节点,这是在连接时发送给客户端的内容。

    要实现您想要做的事情,您需要use hostnames (Admin guide) 而不是 IP 地址来识别每个节点,然后将您的客户端的 DNS 配置为使用 外部 IP 地址,但节点的DNS(或/etc/hosts)使用内部 IP。

    【讨论】:

      猜你喜欢
      • 2016-08-09
      • 2019-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-21
      相关资源
      最近更新 更多