Couchbase连接-外部ip而非内部ip [英] Couchbase Connection - External ip instead of internal

查看:191
本文介绍了Couchbase连接-外部ip而非内部ip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In the same data center I have an application server (the client) connecting to a couchbase cluster containing 3 nodes.

我希望客户端通过内部IP,而不是外部IP,以优化性能。
假定这些是我的IP:

I would like the client to connect via the internal IP and not the external for optimized performance. Let's assume these are my IPs:


  • node1InternalIP / node1ExternalIP

  • node2InternalIP / node2ExternalIP

  • node3InternalIP / node3ExternalIP

在创建我的couchbase客户端(java代码)时,我会提供内部IP,但建立连接后,我会收到以下日志:

When creating my couchbase client (java code) im providing my internal IPs but when the connection has been established I get these logs:

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进行的,这与我有关。

So it seems that authentication is done against the internal IP but the connection itself goes via the external IP - which concerns me.

此外,有时我会m get CheckedOperationTimeoutException:

In addition, once in a while I'm getting CheckedOperationTimeoutException:

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

该异常表明客户端正在从外部IP连接超时。

The exception shows that the client is getting timeout from an external ip connection.

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

How can I make sure my connection will use the internal IPs?

推荐答案

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

Couchbase uses a single address (IP or hostname) to identify each cluster node. These addresses are then sent to clients when bootstrapping so they can connect to all the nodes in the cluster. What you are seeing will be due to you initially setting up the cluster nodes using the external IP address as their names, and this is what is sent to clients when they connect.

要实现您想要的目的,您将需要使用主机名(管理指南),而不是用于标识每个节点的IP地址,然后将客户端的DNS配置为使用外部 IP地址,但使用节点的DNS(或 / etc / hosts )以使用内部 IP。

To achieve what you want to do you will need to use hostnames (Admin guide) instead of IP addresses for identifying each node, then configure your clients' DNS to use the external IP address, but the nodes' DNS (or /etc/hosts) to use the internal IP.

这篇关于Couchbase连接-外部ip而非内部ip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆