Couchbase N1QL查询连接失败

时间:2017-03-28 16:03:09

标签: java mysql maven couchbase

我在maven项目中自定义couchbase sql importer开源代码。 这是我的代码。

CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
            .socketConnectTimeout((int) TimeUnit.SECONDS.toMillis(45))
            .connectTimeout(TimeUnit.SECONDS.toMillis(60))
            .build();
cluster = CouchbaseCluster.create(env,"couchbase-dev.thisisdmg.com:8091");
bucket = cluster.openBucket(bucketName);

com.couchbase.client.java.query.Statement statement = select("*").from(i("sales_agent")).where("meta(t).id = 'appointments_appointment:1'").limit(50).offset(0);
JsonObject placeholderValues = JsonObject.create().put("age", 22);

for (N1qlQueryRow row : bucket.query(N1qlQuery.parameterized(statement, placeholderValues))) {
    System.out.println(row);
}

当我将查询发送到服务器时,我收到了以下错误。

Mar 28, 2017 4:40:28 PM com.couchbase.client.core.endpoint.AbstractEndpoint$2 onSuccess
WARNING: [null][QueryEndpoint]: Could not connect to remote socket.
Mar 28, 2017 4:40:28 PM com.couchbase.client.core.endpoint.AbstractEndpoint$2 onSuccess
WARNING: [null][QueryEndpoint]: Could not connect to endpoint, retrying with delay 4096 MILLISECONDS: 
com.couchbase.client.deps.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: couchbase-dev.thisisdmg.com/5.9.216.200:8093
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at com.couchbase.client.deps.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:257)
    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:631)
    at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:566)
    at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:480)
    at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442)
    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:144)
    at java.lang.Thread.run(Thread.java:745)

请帮助我,我该如何解决这个问题。

0 个答案:

没有答案