couchbase-server in docker using go-couchbase timeout error

520 Views Asked by At

I have a couchbase-server in docker on a GCE instance.

tried using this package https://godoc.org/github.com/couchbase/go-couchbase#GetBucket and followed the example, but I get a timeout error.

2015/04/06 17:32:34  Trying with selected node 0
2015/04/06 17:33:49  HTTP request returned error Get     http://172.17.0.2:8092/default/_design/someKey: dial tcp 172.17.0.2:8092: operation timed out
2015/04/06 17:33:49 error Get http://172.17.0.2:8092/default/_design/someKey: dial tcp 172.17.0.2:8092: operation timed out
exit status 1

I tried executing my golang script on the same host as my docker and it works fine. but from other machine, or local, it won't work

2

There are 2 best solutions below

1
On

There is a fairly aggressive timeout in most of the Couchbase SDKs, as they expect to be close to the cluster.

I expect that's why you're seeing the timeout in the example above but not when the client and server are co-located.

0
On

Adding SO_TIMEOUT=8000 and CONNECTION_TIMEOUT=12000 to the environment variables worked for me. Granted. I am using node.js, but this solution doesn't seem language specific so it would be a good starting point.