在同一个数据中心,我有一个应用程序服务器(客户端)连接到一个包含 3 个节点的 couchbase 集群。
我希望客户端通过内部 IP 而不是外部 IP 进行连接以优化性能。假设这些是我的 IP:
- 节点1内部IP/节点1外部IP
- 节点2内部IP/节点2外部IP
- 节点3内部IP/节点3外部IP
在创建我的 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?