我正在使用 Couchbase-Java-Client-2.5.0 和 couchbase-server-community_4.5.1-ubuntu14.04_amd64.deb。
我在集群中有两个节点,两个节点都在 AWS 中。
尝试运行代码时,我在控制台中收到连接超时和信号断开连接。如果我使用单个节点,则运行相同的代码。
使用的代码:
CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder().connectTimeout(50000).socketConnectTimeout(50000).kvTimeout(60000).searchTimeout(10000).build();
Cluster cluster = CouchbaseCluster.create(env, "ec2-13-56-229-101.us-west-1.compute.amazonaws.com", "ec2-54-183-207-37.us-west-1.compute.amazonaws.com");
Bucket bucket = cluster.openBucket("StellarA","*****");
JsonObject person = JsonObject.create();
person.put("firstname", "Sweta");
person.put("lastname", "Kedia");
JsonDocument document = JsonDocument.create("sweta", person);
bucket.upsert(document);
System.out.println(bucket.get("sweta").content());
控制台输出:
Sep 26, 2017 5:04:22 PM com.couchbase.client.core.CouchbaseCore <init>
INFO: CouchbaseEnvironment: {sslEnabled=false, sslKeystoreFile='null', sslKeystorePassword=false, sslKeystore=null, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=4, computationPoolSize=4, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=12, queryServiceEndpoints=12, searchServiceEndpoints=12, configPollInterval=2500, ioPool=NioEventLoopGroup, kvIoPool=null, viewIoPool=null, searchIoPool=null, queryIoPool=null, coreScheduler=CoreScheduler, memcachedHashingStrategy=DefaultMemcachedHashingStrategy, eventBus=DefaultEventBus, packageNameAndVersion=couchbase-java-client/2.5.0 (git: 2.5.0, core: 1.5.0), retryStrategy=BestEffort, maxRequestLifetime=75000, retryDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=100, upper=100000}, reconnectDelay=ExponentialDelay{growBy 1.0 MILLISECONDS, powers of 2; lower=32, upper=4096}, observeIntervalDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=10, upper=100000}, keepAliveInterval=30000, continuousKeepAliveEnabled=true, keepAliveErrorThreshold=4, keepAliveTimeout=2500, autoreleaseAfter=2000, bufferPoolingEnabled=true, tcpNodelayEnabled=true, mutationTokensEnabled=false, socketConnectTimeout=50000, callbacksOnIoPool=false, disconnectTimeout=25000, requestBufferWaitStrategy=com.couchbase.client.core.env.DefaultCoreEnvironment$2@5a36c9d5, certAuthEnabled=false, coreSendHook=null, queryTimeout=75000, viewTimeout=75000, searchTimeout=10000, analyticsTimeout=75000, kvTimeout=60000, connectTimeout=50000, dnsSrvEnabled=false}
Sep 26, 2017 5:04:26 PM com.couchbase.client.core.node.CouchbaseNode signalConnected
INFO: Connected to Node 13.56.229.101/ec2-13-56-229-101.us-west-1.compute.amazonaws.com
Sep 26, 2017 5:04:26 PM com.couchbase.client.core.node.CouchbaseNode signalConnected
INFO: Connected to Node 54.183.207.37/ec2-54-183-207-37.us-west-1.compute.amazonaws.com
Sep 26, 2017 5:04:31 PM com.couchbase.client.core.node.CouchbaseNode <init>
WARNING: DNS Reverse Lookup of 172.31.25.65/172.31.25.65 is slow, took 4500ms
Sep 26, 2017 5:04:36 PM com.couchbase.client.core.node.CouchbaseNode <init>
WARNING: DNS Reverse Lookup of 172.31.27.0/172.31.27.0 is slow, took 4500ms
Sep 26, 2017 5:04:36 PM com.couchbase.client.core.config.DefaultConfigurationProvider$8 call
INFO: Opened bucket StellarA
Sep 26, 2017 5:04:36 PM com.couchbase.client.core.endpoint.AbstractEndpoint notifyChannelInactive
INFO: [ec2-13-56-229-101.us-west-1.compute.amazonaws.com/13.56.229.101:11210][KeyValueEndpoint]: Got notified from Channel as inactive, attempting reconnect.
Sep 26, 2017 5:04:36 PM com.couchbase.client.core.node.CouchbaseNode signalDisconnected
INFO: Disconnected from Node 13.56.229.101/ec2-13-56-229-101.us-west-1.compute.amazonaws.com
Sep 26, 2017 5:04:36 PM com.couchbase.client.core.node.CouchbaseNode signalDisconnected
INFO: Disconnected from Node 54.183.207.37/ec2-54-183-207-37.us-west-1.compute.amazonaws.com
Sep 26, 2017 5:04:36 PM com.couchbase.client.core.endpoint.AbstractEndpoint notifyChannelInactive
INFO: [null][KeyValueEndpoint]: Got notified from Channel as inactive, attempting reconnect.
Sep 26, 2017 5:04:57 PM com.couchbase.client.core.endpoint.AbstractEndpoint$2 onSuccess
WARNING: [null][KeyValueEndpoint]: Could not connect to remote socket.
Sep 26, 2017 5:04:57 PM com.couchbase.client.core.endpoint.AbstractEndpoint$2 onSuccess
WARNING: [null][KeyValueEndpoint]: Could not connect to remote socket.
Sep 26, 2017 5:04:57 PM com.couchbase.client.core.RequestHandler$1$1 onError
WARNING: Received Error during Reconfiguration.
com.couchbase.client.deps.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: /172.31.25.65:11210
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744)
at com.couchbase.client.deps.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:259)
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:291)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection timed out: no further information
... 11 more
Sep 26, 2017 5:05:18 PM com.couchbase.client.core.endpoint.AbstractEndpoint$2 onSuccess
WARNING: [null][KeyValueEndpoint]: Could not connect to remote socket.
Sep 26, 2017 5:05:18 PM com.couchbase.client.core.endpoint.AbstractEndpoint$2 onSuccess
WARNING: [null][KeyValueEndpoint]: Could not connect to remote socket.
Sep 26, 2017 5:05:18 PM com.couchbase.client.core.endpoint.AbstractEndpoint$2$1 onError
WARNING: Error during reconnect:
com.couchbase.client.deps.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: /172.31.25.65:11210
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744)
at com.couchbase.client.deps.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:259)
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:291)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection timed out: no further information
... 11 more
Sep 26, 2017 5:05:18 PM com.couchbase.client.core.endpoint.AbstractEndpoint$2$1 onError
WARNING: Error during reconnect:
com.couchbase.client.deps.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: /172.31.27.0:11210
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744)
at com.couchbase.client.deps.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:259)
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:291)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection timed out: no further information
... 11 more
Sep 26, 2017 5:05:18 PM com.couchbase.client.core.endpoint.AbstractEndpoint$2 onSuccess
WARNING: [null][KeyValueEndpoint]: Could not connect to endpoint, retrying with delay 32 MILLISECONDS:
com.couchbase.client.deps.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: /172.31.25.65:11210
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744)
at com.couchbase.client.deps.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:259)
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:291)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection timed out: no further information
... 11 more
Sep 26, 2017 5:05:18 PM com.couchbase.client.core.endpoint.AbstractEndpoint$2 onSuccess
WARNING: [null][KeyValueEndpoint]: Could not connect to endpoint, retrying with delay 32 MILLISECONDS:
com.couchbase.client.deps.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: /172.31.27.0:11210
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744)
at com.couchbase.client.deps.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:259)
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:291)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection timed out: no further information
... 11 more
java.lang.RuntimeException: java.util.concurrent.TimeoutException
at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:77)
at com.couchbase.client.java.CouchbaseBucket.upsert(CouchbaseBucket.java:358)
at com.couchbase.client.java.CouchbaseBucket.upsert(CouchbaseBucket.java:353)
at com.src.couchbase.Sample.main(Sample.java:29)
Caused by: java.util.concurrent.TimeoutException
... 4 more