使用 java 客户端连接到备用端口上的 couchbase 运行
Connecting to couchbase running on alternate ports using java client
我正在为 Java 使用 couchbase-client 2.3.2 和 Couchbase 服务器 Community 4.0
所以我正在使用 Couchbase website
上的文档在非标准端口上试验 运行 Couchbase
我已经设法使用这些备用端口启动 Couchbase,但我只设法更改 java 客户端中的一些端口,这是我的代码:
final CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.bootstrapCarrierDirectPort(21210)
.bootstrapHttpDirectPort(9091)
.build();
return CouchbaseCluster.create(env, "10.0.2.15");
我的程序可以连接到couchbase 等等,但是我仍然需要更改客户端中的查看端口(默认8092)和查询端口(默认8093)。结果我遇到了这些错误:
2016-09-30 14:03:49.696 [] WARN c.c.c.c.e.Endpoint - [null][QueryEndpoint]: Could not connect to endpoint, retrying with delay 32 MILLISECONDS: ! java.net.ConnectException: Connection refused: /10.0.2.15:8093
2016-09-30 14:03:52.077 [] WARN c.c.c.c.e.Endpoint - [null][ViewEndpoint]: Could not connect to endpoint, retrying with delay 2048 MILLISECONDS: ! java.net.ConnectException: Connection refused: /10.0.2.15:8092
所以客户端仍然尝试连接到 8092 和 8093,而事实上我已经将它们更改为 9092 和 9093
来自JavaDoc on 2.3.4 (http://docs.couchbase.com/sdk-api/couchbase-java-client-2.3.4/),我相信你想要的是这个:
DefaultCouchbaseEnvironment.Builder viewEndpoints(int viewServiceEndpoints)
即使它完全没有记录,您也需要将这些端口添加到 static_config:
{capi_port, 9092}.
{query_port, 9093}.
然后它起作用了,希望 couchbase 的人看到这个并更新他们的文档:)
我正在为 Java 使用 couchbase-client 2.3.2 和 Couchbase 服务器 Community 4.0
所以我正在使用 Couchbase website
上的文档在非标准端口上试验 运行 Couchbase我已经设法使用这些备用端口启动 Couchbase,但我只设法更改 java 客户端中的一些端口,这是我的代码:
final CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.bootstrapCarrierDirectPort(21210)
.bootstrapHttpDirectPort(9091)
.build();
return CouchbaseCluster.create(env, "10.0.2.15");
我的程序可以连接到couchbase 等等,但是我仍然需要更改客户端中的查看端口(默认8092)和查询端口(默认8093)。结果我遇到了这些错误:
2016-09-30 14:03:49.696 [] WARN c.c.c.c.e.Endpoint - [null][QueryEndpoint]: Could not connect to endpoint, retrying with delay 32 MILLISECONDS: ! java.net.ConnectException: Connection refused: /10.0.2.15:8093
2016-09-30 14:03:52.077 [] WARN c.c.c.c.e.Endpoint - [null][ViewEndpoint]: Could not connect to endpoint, retrying with delay 2048 MILLISECONDS: ! java.net.ConnectException: Connection refused: /10.0.2.15:8092
所以客户端仍然尝试连接到 8092 和 8093,而事实上我已经将它们更改为 9092 和 9093
来自JavaDoc on 2.3.4 (http://docs.couchbase.com/sdk-api/couchbase-java-client-2.3.4/),我相信你想要的是这个:
DefaultCouchbaseEnvironment.Builder viewEndpoints(int viewServiceEndpoints)
即使它完全没有记录,您也需要将这些端口添加到 static_config:
{capi_port, 9092}.
{query_port, 9093}.
然后它起作用了,希望 couchbase 的人看到这个并更新他们的文档:)