Hello! I would like to ask a question. Currently, I have a cluster with three nodes, and I simulated a failure in one of the nodes (192.168.11.110). At this moment, is it the only option to manually press Failover and Rebalance on the Web UI?
Regarding the Java SDK, is it unable to automatically connect to the functioning node during the failure period of (192.168.11.110)?
I currently have three nodes. How can I set up failover on the Web UI?
environment
my settings
my program
package ecomshop;
import java.time.Duration;
import com.couchbase.client.core.deps.io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.ClusterOptions;
import com.couchbase.client.java.Collection;
import com.couchbase.client.java.Scope;
import com.couchbase.client.java.env.ClusterEnvironment;
import com.couchbase.client.java.json.JsonObject;
import com.couchbase.client.java.kv.GetResult;
import com.couchbase.client.java.kv.MutationResult;
import com.couchbase.client.java.query.QueryResult;
public class ClusterDBConfig {
static final String connectionString="192.168.11.110,192.168.11.107,192.168.11.111"; //ok
static final String username="Admin";
static final String password="ecom@168";
static final String bucketName="Test";
static final String scopeName="Commerce";
static final String collectionName="customers";
public static void main(String[] args) {
Cluster cluster = null;
try {
cluster = Cluster.connect(connectionString, ClusterOptions.clusterOptions(username, password));
cluster.waitUntilReady(Duration.ofSeconds(10));
Bucket customerBucket = cluster.bucket(bucketName);
Scope customerScope = customerBucket.scope(scopeName);
Collection customerCollection= customerScope.collection(collectionName);
//查詢資料
GetResult queryResult = customerCollection.get("a0001");
System.out.println(queryResult.contentAsObject());
} catch (Exception e) {
e.printStackTrace();
}finally {
if(cluster!=null) {
cluster.disconnect();
}
}
}
}