Java - Initial connection through VIP

We want to use a VIP to front our Couchbase cluster to simplify configuration and maintenance. Our VIP is configured to round-robin port 8091 to the nodes in our Couchbase cluster. No other ports are forwarded.

Basically we’d expect to go through the VIP to get the latest cluster map at bootstrap and then the clients should use that for all communication afterwards.

This seems to work fine with the Java 1.4.11 Client and the .NET client (2.2.2). It does not work with Java 2.2.3.

The error I get is:
> WARNING: [null][KeyValueEndpoint]: Could not connect to endpoint, retrying with delay 32 MILLISECONDS:
> Connection refused: /

where is the IP of our VIP

For this simple example, I’m connecting to the cluster by:

CouchbaseCluster cluster = CouchbaseCluster.create(host);
bucket = cluster.openBucket(bucketName, bucketPassword);


I noticed in the logs: “bootstrapCarrierDirectPort=11210” which correlates with the error… I wouldn’t expect to need access to this port until after the client is fully connected.

Maybe @simonbasle can help you on that one.

1 Like

@unhuman actually, 11210 is used for the bootstrap process before falling back to HTTP. So both 11210 and optionally 8091 are needed in the bootstrap process for buckets… you can see it falling back to 8091 if it can’t do 11210, but if you can make 11210 work.

Note that you can explicitly also disable carrierBootstrap on the environment and it will go to 8091 directly, but we don’t recommend doing that.

Well, if I had 11210 disabled, the client wouldn’t connect at all, hence this topic. It didn’t successfully fall back. But, enabling 11210 did work for us. We can do that going forward, just good to know, as it appears to be a new change that didn’t affect the old Java client nor the .NET client.

Thanks for the explanation. We can work with it.

Can you disable 11210 just for testing, enable TRACE logging and send me the full log? So I can see the bootstrap process, communication and where/why it fails.


@daschl Thanks!
Attached logs. I changed IP to, but otherwise they’re as reported. (5.4 KB)

Hey @daschl Any update on this?

Checking in again.

We’re actually having an issue with the 1.4 client (with port 11210 open):

We’re seeing port 11210 connections through the VIP being maintained even after the Cluster Map is received and the client should, in theory, have closed the connections on port 11210 and reconnected to what was provided in the Cluster Map. This is using Java Client 1.4.10. I’ve checked and the diff in 1.4.11 shouldn’t have an effect here.

I guess my hope for the above is that it’s a leaked / unused connection.

We see this in the call stack:
Exception in thread “Memcached IO over {CouchbaseConfigConnection to /}” java.lang.NullPointerException
at com.couchbase.client.vbucket.provider.BucketConfigurationProvider$2.connectionLost(
at net.spy.memcached.MemcachedConnection.lostConnection(
at net.spy.memcached.MemcachedConnection.handleIO(
at net.spy.memcached.MemcachedConnection.handleIO(

On line 276 of BucketConnectionProvider, I can’t figure out how that could throw an NPE.

Also, we are seeing a ton of errors on our clients that are not reconnecting back to the nodes that have been rebalanced. We see that with a ton of warnings / errors in the logs, no traffic for a particular bucket on a particular node (even though the other nodes are taking traffic for that bucket). Our .NET Clients are not having similar problems.

{"timestamp":"2016-03-03T19:48:55.606Z","level":"DEBUG","thread":"Memcached IO over {MemcachedConnection to 121:11210}","logger":"com.couchbase.client.CouchbaseConnection","m essage":"Handling IO for: (r=true, w=false, c=false, op={QA sa= 10, #Rops=1, #Wops=0, #iq=0, topRop=Cmd: 2 Opaque: 1190090 Key: S2::XYZXYZ-rabbitmq-consumer::string::message::lock::S2::555 58684-e267-4326-bf47-597c1b2aa8b0 Cas: 0 Exp: 605 Flags: 0 Data Length: 3, topWop=null, toWrite=0, interested=1})","context":"defa ult"} {"timestamp":"2016-03-03T19:48:55.606Z","level":"DEBUG","thread":"Memcached IO over {MemcachedConnection to 121:11210}","logger":"com.couchbase.client.CouchbaseConnection","m essage":"Read 7885 bytes","context":"default"} {"timestamp":"2016-03-03T19:48:55.606Z","level":"DEBUG","thread":"Memcached IO over {MemcachedConnection to 121:11210}","logger":"net.spy.memcached.protocol.binary.StoreOpera tionImpl","message":"Reading 24 header bytes","context":"default"} {"timestamp":"2016-03-03T19:48:55.606Z","level":"DEBUG","thread":"Memcached IO over {MemcachedConnection to 121:11210}","logger":"net.spy.memcached.protocol.binary.StoreOpera tionImpl","message":"Reading 7861 payload bytes","context":"default"} {"timestamp":"2016-03-03T19:48:55.606Z","level":"DEBUG","thread":"Memcached IO over {MemcachedConnection to 121:11210}","logger":"net.spy.memcached.protocol.binary.StoreOpera tionImpl","message":"Transitioned state from READING to RETRY","context":"default"} {"timestamp":"2016-03-03T19:48:55.609Z","level":"DEBUG","thread":"Memcached IO over {MemcachedConnection to 121:11210}","logger":"com.couchbase.client.vbucket.config.Couchbas eConfig","message":"Nodes with active VBuckets: [,,]","context":"default"} {"timestamp":"2016-03-03T19:48:55.609Z","level":"DEBUG","thread":"Memcached IO over {MemcachedConnection to 121:11210}","logger":"com.couchbase.client.CouchbaseConnection","m essage":"Reschedule read op due to NOT_MY_VBUCKET error: Cmd: 2 Opaque: 1190090 Key: S2::XYZXYZ-rabbitmq-consumer::string::m essage::lock::S2::55558684-e267-4326-bf47-597c1b2aa8b0 Cas: 0 Exp: 605 Flags: 0 Data Length: 3 ","context":"default"} {"timestamp":"2016-03-03T19:48:55.612Z","level":"DEBUG","thread":"Memcached IO over {MemcachedConnection to 121:11210}","logger":"net.spy.memcached.protocol.binary.BinaryMemc achedNodeImpl","message":"Setting interested opts to 0","context":"default"} {"timestamp":"2016-03-03T19:48:55.612Z","level":"WARN","thread":"Memcached IO over {MemcachedConnection to 21:11210}","logger":"com.couchbase.client.CouchbaseConnection","me ssage":"Cancelling operation Cmd: 2 Opaque: 1190090 Key: S2::XYZXYZ-rabbitmq-consumer::string::message::lock::S2::55558684-e 267-4326-bf47-597c1b2aa8b0 Cas: 0 Exp: 605 Flags: 0 Data Length: 3because it has been retried (cloned) more than 100times.","context":"default"}

And, if we look locally, we have no connectivity to on port 11210, while the Cluster Map alluded to above does know about

netstat -anp | grep *PID* | grep 11210

tcp 0 0 ::ffff: ::ffff: ESTABLISHED 28077/java tcp 0 0 ::ffff: ::ffff: ESTABLISHED 28077/java tcp 0 0 ::ffff: ::ffff: ESTABLISHED 28077/java tcp 0 0 ::ffff: ::ffff: ESTABLISHED 28077/java tcp 0 0 ::ffff: ::ffff: ESTABLISHED 28077/java tcp 0 0 ::ffff: ::ffff: ESTABLISHED 28077/java

Restarting our applications, of course, resolves the problem… Until we continue the maintenance.

@unhuman something seems to be wrong with the download - let me follow up via PM