Couchbase connection timeout with Java SDK

Thanks to the article https://forums.couchbase.com/t/unable-to-connect-to-db-java-util-concurrent-timeoutexception/4471/3

The problem is solved.

It need to add longer connectTimeout as below

CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
                    .connectTimeout(10000) // 10000ms = 10s, default is 5s
                    .queryEnabled(true).build();

If you are like me who likes jvm switches in certain cases, you can do the following.

java -Xms1g -Xmx4g -Dspring.profiles.active=local -Dcom.couchbase.connectTimeout=60000 <program>

https://docs.couchbase.com/java-sdk/2.7/client-settings.html

all client settings can be specified with prefix "com.couchbase"