Not able to connect to 8092 using Java API


#1

I am not able to connect to 8092 with is mapped to ‘51002’ in Virtual Machine.

Exception:

[WARN] [null][ViewEndpoint]: Could not connect to endpoint, retrying with delay 32 MILLISECONDS:
java.net.ConnectException: Connection timed out: no further information: dev-couchbase-1.cloudapp.net/40.114.51.10:8092
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.7.0_71]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739) ~[na:1.7.0_71]
at com.couchbase.client.deps.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:208) ~[core-io-1.1.4.jar:1.1.4]
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:281) ~[core-io-1.1.4.jar:1.1.4]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528) [core-io-1.1.4.jar:1.1.4]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [core-io-1.1.4.jar:1.1.4]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [core-io-1.1.4.jar:1.1.4]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [core-io-1.1.4.jar:1.1.4]
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [core-io-1.1.4.jar:1.1.4]
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [core-io-1.1.4.jar:1.1.4]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
[DEBUG] Received signal for outdated configuration.
[DEBUG] [dev-couchbase-1.cloudapp.net/40.114.51.10:51011][KeyValueEndpoint]: Identified Idle State, signalling config reload.

In Virtual Machine we mapped port

8091 >> 51001
8092 >> 51002

I am not able to change application to point to port # 51002.

Please help me here…


#2

The port number is advertised by the cluster manager, so it’s not something that is configurable at the client. There are multiple services on each node.

What I’ve done in this case is set up my VM (in VirtualBox, but I’m sure others are similar) to have it’s own IP and a virtual network. That way, it works just like any other system.

Also, we have Couchbase Server for a wide variety of OSs so you can usually just run without a VM.


#3

Hi Matt,

I am able to run application in my local m/c with localhost and 8092 port when my client and server are on same m/c.

But I have a requirement to deploy client and server on different VM and in VM we can’t use the default ports of Couchbase.

Is there any way to point Java Client to port other than 8092?


#4

At the moment, there is no supported way. One possible way would be to write a small http proxy and do the port translation of what you get off of the HTTP bootstrap. Another possible way is to build your own static config file. Maybe @avsej knows if there is support for that.

If you’re going to have multiple nodes in the cluster, then you’ll need to open those ports though. It’s not a question of the client accessing the node alone.


#5

Hi @ingenthr,

I can’t open the default port due to organization restriction. But I am able to map other ports of Couchbase Server and able to access them except 8092.


#6

@vinod as @ingenthr said, there is no way to override ports, because the couchbase server advocates those ports through its configuration. Also the servers intercommunicate on specific ports, so you need an overall strategy on that.


#7

Thanks @daschl and @ingenthr for your time.

I may need to find some workaround or ask network people to open port 8092.


#8

@vinod its not only about 8092, but also 11210, 8091 and potentially 8093 from 4.0 on if you want to use N1QL. The intra-cluster communication uses even more high level ports (you can find all of them in the server docs).


#9

Hi @ingenthr and @daschl, I am able to change the port by following steps mentioned in > http://docs.couchbase.com/admin/admin/Install/user-defined-ports.html and it’s working for me.


#10

Hi,

Sorry to revive old conversation, but I am facing the same issue and changing the port in capi.ini did not fix our issue - the java SDK still tries to connect to 8092 as I can see in the trace logs.
In the couchbase environment builder class I can find a way to set all other ports, except 8092.

And I cannot use 8092, because we have different couchbase clusters running in docker containers on the same machine and there is no way I can use the default port for all containers.


#11

To further elaborate on the topic - I see in the .NET SDK documentation that there is ApiPort client configuration property which can be used to change the default 8092 port, but I cannot find such anywhere in the Java SDK.


#12

If anyone is interested I managed to change the 8092 port by manually adding and removing the VIEW Service using RemoveServiceRequest and AddServiceRequest. It seems dummy, but for development purposes is doing its job


#13

@ivanov.lyuben would it be possible that, without the add service request, you share the TRACE log? I’d love to see what config the server returns :slight_smile: