Unable to connect to server with changed view/capi port

connections
java

#1

I’m running Couchbase server community 4.0 couchbase-client 2.3.2.

I’ve changed all couchbase ports from the default ports (both in static_config and capi.ini).

this is my code:

    final CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
            .bootstrapCarrierDirectPort(21210)
            .bootstrapHttpDirectPort(9091)
            .build();
    return CouchbaseCluster.create(env, "10.0.2.15");

However I get this error message:

2016-09-30 15:43:48.441 [] WARN c.c.c.c.e.Endpoint - [null][ViewEndpoint]: Could not connect to endpoint, retrying with delay 4096 MILLISECONDS: ! java.net.ConnectException: Connection refused: /10.0.2.15:8092

I can access http://10.0.2.15:9092/ in my browser (9092 is the port I changed it to in couchbase)
But I can’t really figure out how to get the client to connect using that port. I solved port 8093 by adding {query_port, 9093}.to static_config (a option that is not documented on Network Configuration )


#2

Hi @richard.tjerngren,

The client gets the port information from the server. Do you see a json response with couchdb property when you access the port from a browser/curl?


#3

If I access couchbase on the capi port with a browser (which I changed from 8092 to 9092) I get the following response:

{“couchdb”:“Welcome”,“version”:"",“couchbase”:“4.0.0-4051-community”}


#4

Just verifying something is listening on that port doesn’t mean it’s necessarily been changed correctly. Note that static_config and the ini file are read and put into a cluster configuration at configuration time only. If you change them after this, the changes may not take effect.

One quick way to verify this is to visit /pools/default/buckets/<bucket name> with your browser or your favorite HTTP rest test tool. Another more complete way is probably to just turn the log level up to finest and try to do a single operation. You should see the configuration the client is receiving from your cluster there in the log.


#5

Thanks for your response, I’ve attached the output of that querying that url below,
I see no mention of of the port I tried to change, should it be there?

https gist.github.com/RichoDemus/86fdc361065e94c5f270bdaa4d2d1857
(sorry for not posting a correct link, the forums won’t let me paste any more URLs)


#6

I dug this out of the logs on the client:

2016-10-06 13:22:40.823 [] DEBUG c.c.c.c.c.ConfigurationProvider - Applying new configuration
DefaultCouchbaseBucketConfig{
name=‘myBucket’,
locator=VBUCKET,
uri=’/pools/default/buckets/myBucket?bucket_uuid=d1b062063e6dd990b500420c440f2a9e’,
streamingUri=’/pools/default/bucketsStreaming/myBucket?bucket_uuid=d1b062063e6dd990b500420c440f2a9e’,
nodeInfo=[NodeInfo{, hostname=/10.0.2.15, configPort=0, directServices={QUERY=9093, BINARY=22000, VIEW=8092, CONFIG=9091}, sslServices={}}]

So it really seems like couchbase doesn’t send the changed view port information to the client, I’m suspecting it is because I’ve only changed it in capi.ini and not static_config (the documentation doesn’t say you need to change it in static_config though)


#7

I finally got it to work, so for people who get here and are stuck: I added “{capi_port, 9092}.” to the file (which is completely undocumented…) and now it works