List specs = new ArrayList<>();
ClusterEnvironment environment = ClusterEnvironment.create();
Coordinator coordinator = Coordinators.isolated(environment, specs, new IsolatedCoordinator.Options()
.gracePeriod(1000L)
);
TrafficMonitoringFailureDetector.Options opts = TrafficMonitoringFailureDetector.options()
.maxFailedOperations(5);
// Add for service scope like ---> .serviceScope(Arrays.asList(ServiceType.BINARY, ServiceType.QUERY))
// for node-local rather than global tracking ---> .nodeScope(true)
FailureDetectorFactory<?> detector = FailureDetectors.trafficMonitoring(coordinator, opts);
/*
* Initialize the client and open the collection
*/
McaCluster cluster = new McaCluster(coordinator, detector);
McaBucket mcaBucket = cluster.bucket("travel-sample");
McaCollection mcaCollection = mcaBucket.defaultCollection();
POM Dependencies:
com.couchbase.client
java-client
3.2.5
com.couchbase.client
multi-cluster-java
2.0.0
with core-io 2.2.6 and 2.2.5 versions(seeing nested exception is java.lang.NoClassDefFoundError:
com/couchbase/client/core/cnc/tracing/ThresholdRequestTracer
).
So, tried going back to older version of couchbase-core-io dependency, it fixed this “ThresholdRequestTracer” issue but seeing new Exception for “CoreQueryAccessor” class that is available in versions after 2.2.0
nested exception is java.lang.NoClassDefFoundError:com/couchbase/client/core/msg/query/CoreQueryAccessor
<dependency>
<groupId>com.couchbase.client</groupId>
<artifactId>core-io</artifactId>
<version>2.1.8</version>
</dependency>