Connecting coucbase client using alternate port than 8093


#1

As I understand , support for queryPort was removed from DefaultCoreEnvironment, we can no longer use an alternate port for default query port of 8093. If a CouchbaseClient connection is created without queryPort , we end up seeing this error

Connection refused: eaasrt2/192.168.2.102:8093

Please suggest how can we get pass this issue.

NOTE : Couchbase is being connected as a docker image


#2

Hi Mahesh,

I asked around, and apparently the Java SDK automatically gets the query port from the cluster config map. Couchbase Server tells the client what host and port to use for N1QL (and other services), and there’s no need for manual configuration.

I wonder if this could be a connectivity issue. What do you see if you try to hit the query service manually from the same machine the client is running on? (Replace the IP address / hostname as appropriate.)

curl http://192.168.2.102:8093/query/service

If the service is running and accessible, the response should look something like

{
"requestID": "39611a38-00da-49d9-9aef-4a5c2b13ebdb",
"errors": [{"code":1050,"msg":"No statement or prepared value"}],
"status": "fatal",
"metrics": {"elapsedTime": "46.03µs","executionTime": "45.864µs","resultCount": 0,"resultSize": 0,"errorCount": 1}
}

#3

Hi David,

Thanks for the response. Well the issue is that our CI pipeline build
machine is different from the kubernetes cluster on which couchbase is
deployed as a container. Doing what you suggested will not work unless we
do a port forward, which i am not sure will work, since there are other
builds running on same setup.

Anyhow, we managed to get around the problem by using curl to push data
into our bucket, but i really found this surprising that this feature was
removed without any alternative option or workaround for cases when java
client is to connect to a remote couchbase cluster

Thanks,
Mahesh