{"id":4641,"date":"2018-02-19T15:01:36","date_gmt":"2018-02-19T23:01:36","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=4641"},"modified":"2025-06-13T20:46:29","modified_gmt":"2025-06-14T03:46:29","slug":"couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/","title":{"rendered":"Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client"},"content":{"rendered":"<div class=\"paragraph\">\n<p>In this post, I\u2019m going to take a look at a sample application that uses the <a title=\"Couchbase Server\" href=\"https:\/\/www.couchbase.com\/products\/server\/\">Couchbase Server<\/a> Multi-Cluster Aware (MCA) Java client. This client goes hand-in-hand with Couchbase\u2019s Cross-Data Center Replication (<a title=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/xdcr\/xdcr-intro.html\" href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/xdcr\/xdcr-intro.html\">XDCR<\/a>) capabilities.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>XDCR supports flexible replication of data between different clusters. XDCR is an important feature for large scale, multi-data center deployments. The references below include several on XDCR. The MCA client can automatically redirect traffic to these separate clusters based on library configuration, relieving the application developer of managing much of the complexity involved.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>These and other features allow Couchbase deployments to support a range of strong <a href=\"https:\/\/www.couchbase.com\/blog\/combine-clusters-to-achieve-high-availability\/\">high availability<\/a> and disaster recovery strategies. To find out more before diving deeper into client specifics, take a look at these resources:<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Intro to Couchbase HA\/DR &#8211; <a title=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/ha-dr\/ha-dr-intro.html\" href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/ha-dr\/ha-dr-intro.html\">High Availability\/Disaster Recover documentation<\/a><br \/>\nCouchbase XDCR &#8211; <a title=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/xdcr\/xdcr-intro.html\" href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/xdcr\/xdcr-intro.html\">XDCR documentation<\/a><br \/>\nXDCR\/MCA webinar (including technical demo) &#8211; <a title=\"https:\/\/event.on24.com\/eventRegistration\/EventLobbyServlet?target=reg20.jsp&amp;referrer=https%3A%2F%2Fwww.couchbase.com%2Fresources%2Fwebinars&amp;eventid=1569790&amp;sessionid=1&amp;key=86048A27BD53D35AFA6FFF8D43A09435&amp;regTag=&amp;sourcepage=register\" href=\"https:\/\/event.on24.com\/eventRegistration\/EventLobbyServlet?target=reg20.jsp&amp;referrer=https%3A%2F%2Fwww.couchbase.com%2Fresources%2Fwebinars&amp;eventid=1569790&amp;sessionid=1&amp;key=86048A27BD53D35AFA6FFF8D43A09435&amp;regTag=&amp;sourcepage=register\" rel=\"noopener noreferrer\">HA\/DR webinar<\/a><br \/>\nWebinar tutorial &#8211; <a title=\"https:\/\/github.com\/couchbaselabs\/mca-java-sample\/blob\/master\/Tutorial.adoc\" href=\"https:\/\/github.com\/couchbaselabs\/mca-java-sample\/blob\/master\/Tutorial.adoc\">Setting up clusters step-by-step, with XDCR<\/a><br \/>\nA deeper look at XDCR &#8211; <a title=\"https:\/\/www.couchbase.com\/blog\/deep-dive-cross-data-center-replication-xdcr\/\" href=\"https:\/\/www.couchbase.com\/blog\/deep-dive-cross-data-center-replication-xdcr\/\">Deep Dive on Cross Data Center Replication (XDCR)<\/a> by <a title=\"https:\/\/twitter.com\/deniswsrosa\" href=\"https:\/\/twitter.com\/deniswsrosa\">Denis Rosa<\/a><br \/>\nSetting up XDCR using Docker &#8211; <a title=\"https:\/\/www.couchbase.com\/blog\/replicate-nosql-data-between-datacenters-with-couchbase-xdcr\/\" href=\"https:\/\/www.couchbase.com\/blog\/replicate-nosql-data-between-datacenters-with-couchbase-xdcr\/\">Replicate NoSQL Data Between Datacenters with Couchbase XDCR<\/a> by <a title=\"https:\/\/twitter.com\/nraboy\" href=\"https:\/\/twitter.com\/nraboy\">Nick Raboy<\/a><br \/>\nShort video on setting up XDCR using Docker &#8211; <a title=\"https:\/\/www.couchbase.com\/blog\/use-xdcr-replicate-nosql-data-couchbase-docker-containers\/\" href=\"https:\/\/www.couchbase.com\/blog\/use-xdcr-replicate-nosql-data-couchbase-docker-containers\/\">Use XDCR to Replicate NoSQL Data Between Couchbase Docker Containers \u2013 Video Tutorial<\/a> by <a title=\"https:\/\/twitter.com\/nraboy\" href=\"https:\/\/twitter.com\/nraboy\">Nick Raboy<\/a><\/p>\n<\/div>\n<h2 id=\"_mca_client_details_in_brief\">MCA Client Details in Brief<\/h2>\n<div class=\"paragraph\">\n<p>The MCA Java SDK builds on the standard <a title=\"https:\/\/docs.couchbase.com\/java-sdk\/current\/start-using-sdk.html\" href=\"https:\/\/docs.couchbase.com\/java-sdk\/current\/start-using-sdk.html\">Couchbase Java SDK<\/a>. The core API mostly mimics that of the standard client.<\/p>\n<\/div>\n<div class=\"paragraph\">Currently the MCA client adds several other groups of features, including:<\/div>\n<ol>\n<li>The ability to prioritize a list of clusters.<\/li>\n<li>Ways to supply rules on what constitutes a failure.<\/li>\n<li>APIs to coordinate client instances.<\/li>\n<li>A management interface.<\/li>\n<\/ol>\n<p>We\u2019ll discuss the first two using the code sample. Management happens programmatically, or via a JMX interface. This allows administrators to switch clusters in the priority list. It falls outside the scope of this post.<\/p>\n<h2 id=\"_the_sample_application\">The Sample application<\/h2>\n<div class=\"paragraph\">\n<p>To illustrate use of the MCA client, we have a straightforward sample application. The app runs a configurable number of threads in groups. One group simply reads from the database, one writes new, random records, one reads documents, modifies them, then writes them back, and one performs a simple <a title=\"n1ql\" href=\"https:\/\/www.couchbase.com\/products\/n1ql\/\">N1QL<\/a> query. The idea is to provide a variety of loads to apply against a cluster. In <a title=\"https:\/\/event.on24.com\/eventRegistration\/EventLobbyServlet?target=reg20.jsp&amp;referrer=https%3A%2F%2Fwww.couchbase.com%2Fresources%2Fwebinars&amp;eventid=1569790&amp;sessionid=1&amp;key=86048A27BD53D35AFA6FFF8D43A09435&amp;regTag=&amp;sourcepage=register\" href=\"https:\/\/event.on24.com\/eventRegistration\/EventLobbyServlet?target=reg20.jsp&amp;referrer=https%3A%2F%2Fwww.couchbase.com%2Fresources%2Fwebinars&amp;eventid=1569790&amp;sessionid=1&amp;key=86048A27BD53D35AFA6FFF8D43A09435&amp;regTag=&amp;sourcepage=register\" rel=\"noopener noreferrer\">this webinar<\/a>, we used this app to illustrate some simple inter-cluster failover behavior.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>You can find the complete code, along with build instructions and other materials <a title=\"https:\/\/github.com\/couchbaselabs\/mca-java-sample\" href=\"https:\/\/github.com\/couchbaselabs\/mca-java-sample\">on GitHub<\/a>. Here\u2019s an example invocation running against two 3-node clusters with 10 threads updating documents.<\/p>\n<\/div>\n<pre class=\"lang:sh decode:true \">java -jar mca-1.0.jar -c 172.23.123.4,172.23.123.5,172.23.123.6:172.23.122.55,172.23.122.56,172.23.122.57 -b my_bucket -i user -p password -u 10 -l statistics<\/pre>\n<p>Now, let\u2019s go through the main parts of the code.<\/p>\n<h2 id=\"_code_walkthrough\">Code Walkthrough<\/h2>\n<div class=\"paragraph\">\n<p>The application code, in this case, consists of one main class and some simple helper classes. Once we have the MCA client instance, it\u2019s used almost exactly like the regular client. I\u2019ll just focus, then, on the client set up. The code comes from the\u00a0<a title=\"https:\/\/github.com\/couchbaselabs\/mca-java-sample\/blob\/master\/src\/main\/java\/com\/couchbase\/server\/mca\/ClusterBasics.java\" href=\"https:\/\/github.com\/couchbaselabs\/mca-java-sample\/blob\/master\/src\/main\/java\/com\/couchbase\/server\/mca\/ClusterBasics.java\">ClusterBasics<\/a> class.<\/p>\n<\/div>\n<div class=\"sect3\">\n<h4 id=\"_cluster_nodes_and_groupings\">Cluster Nodes and Groupings<\/h4>\n<div class=\"paragraph\">\n<p>Clusters are specified on the command line as groups of nodes separated by colons (<code>:<\/code>). Within each group, the nodes names or IP addresses are separated by commas. Implicitly, the clusters are specified in priority order. This code block breaks down that simple format into sets and creates a cluster spec for each cluster. (A cluster spec can include an id for easy reference. It wasn\u2019t necessary here, but worthwhile to point out.)<\/p>\n<\/div>\n<pre class=\"lang:java decode:true\">String[] clusters = options.stringValueOf(\"clusters\").split(\":\");\r\n\r\nList&lt;ClusterSpec&gt; specs = new ArrayList&lt;&gt;(clusters.length);\r\n\r\nfor (String cluster: clusters) {\r\n  Set&lt;String&gt; nodes = Arrays.stream(cluster.split(\",\")).collect(Collectors.toSet());\r\n  specs.add(ClusterSpec.create(nodes));\r\n}<\/pre>\n<\/div>\n<h4 id=\"_couchbase_service_types\">Couchbase Service Types<\/h4>\n<div class=\"paragraph\">\n<p>We\u2019ll talk about coordination and failure monitoring in a moment. You can tune both by service type. In this example, we\u2019re using direct key\/value retrieval (<code>ServiceType.BINARY<\/code>) and N1QL queries (<code>ServiceType.QUERY<\/code>). These next two lines prepare a set of service types for use later.<\/p>\n<\/div>\n<pre class=\"lang:java decode:true\">serviceTypes.add(ServiceType.BINARY);\r\nserviceTypes.add(ServiceType.QUERY);<\/pre>\n<h4 id=\"_inter_client_coordination\">Inter-client Coordination<\/h4>\n<div class=\"paragraph\">\n<p>Next we start to see the real difference in capabilities of this client. <code>Coordinators<\/code> manage orchestration of behavior across client instances. Currently, only isolated coordinators have been implemented, but that\u2019s appropriate for this case anyway. More sophisticated ones are planned for the future. Still, looking at all the options, you can see even an isolated coordinator allows quite a bit of control. Here\u2019s how to create one with some non-default options.<\/p>\n<\/div>\n<pre class=\"lang:java decode:true\">Coordinator coordinator = Coordinators.isolated(new IsolatedCoordinator.Options() \r\n  .clusterSpecs(specs) \r\n  .activeEntries(specs.size()) \r\n  .failoverNumNodes(2) \r\n  .gracePeriod(TIMEOUT) \r\n  .topologyBehavior(TopologyBehavior.WRAP_AT_END) \r\n  .serviceTypes(serviceTypes) \r\n);<\/pre>\n<div>\n<p>Code notes (by line number):<\/p>\n<ol>\n<li>Create an `IsolatedCoordinator` instance with the configured options<\/li>\n<li>Specify the nodes for each member of this topology<\/li>\n<li>Set the number of clusters to consider active<\/li>\n<li>Set the number of individual failed nodes before a whole cluster fails over completely<\/li>\n<li>Grace period after failure before cluster switchover<\/li>\n<li>Select the behavior when the end of a topology is reached. Alternatives include staying at the end cluster, or reversing through the list. The best option will depend on your specific scenario.<\/li>\n<li>Assign the services governed<\/li>\n<\/ol>\n<h4 id=\"_failure_detection\">Failure Detection<\/h4>\n<div class=\"paragraph\">\n<p>The client can monitor quite a lot of information while operating. Failure detectors make use of this wealth of insight happening under the hood. They use it to signal the coordinator. The coordinator can then decide how to respond.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>A <code>TrafficMonitoringFailureDetector<\/code> watches requests sent to the server. You can configure the kinds of errors (exceptions) to count, the threshold number of exceptions, time interval in which they must occur and more. I mostly use the defaults and just tune the failed operation count and interval.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>The client also has visibility into what\u2019s going on with nodes and the cluster directly. This is captured using a <code>NodeHealthFailureDetector<\/code>. There are some nuances best left for the documentation. I just use the defaults here.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Finally, you can construct complex condition combinations using <code>ConjunctionFailureDetector<\/code> and <code>DisjunctionFailureDetector<\/code>. Think of conjunction detectors as performing a logical &#8220;and&#8221; of the constituent detectors. Disjunction does an &#8220;or&#8221;. I want to trigger on any failure, so I plug my traffic and health monitoring into a <code>DisjunctionFailureDetector<\/code> to get the final detector object to hand to the client.<\/p>\n<\/div>\n<pre class=\"lang:java decode:true\">TrafficMonitoringFailureDetector.Options trafficOptions = TrafficMonitoringFailureDetector.options() \r\n  .maxFailedOperations(5) \r\n  .failureInterval(60); \r\n\r\nFailureDetectorFactory&lt;TrafficMonitoringFailureDetector&gt; traffic = FailureDetectorFactories.trafficMonitoring(coordinator, trafficOptions); \r\n\r\nNodeHealthFailureDetector.Options healthOptions = NodeHealthFailureDetector.options();\r\n\r\nFailureDetectorFactory&lt;NodeHealthFailureDetector&gt; health = FailureDetectorFactories.nodeHealth(coordinator, healthOptions); \r\n\r\nDisjunctionFailureDetectorFactory detector = FailureDetectorFactories.disjunction(traffic, health);<\/pre>\n<p>Code notes (by line number):<\/p>\n<ol>\n<li>Instantiate and configure the <code>TrafficMonitoringFailureDetector<\/code> options<\/li>\n<li>Fix the number of failed operations needed to indicate a problem<\/li>\n<li>Set the time interval over which to bin failures<\/li>\n<li value=\"5\">Create a <code>TrafficMonitoringFailureDetector<\/code> factory instance, with access to the <code>Coordinator<\/code> to trigger, and our options<\/li>\n<li value=\"9\">Create a <code>NodeHealthFailureDetector<\/code> with default options<\/li>\n<li value=\"11\">Define the final logic using a <code>DisjunctionFailureDetector<\/code>, again via a factory<\/li>\n<\/ol>\n<\/div>\n<h4 id=\"_client_instantiation\">Client Instantiation<\/h4>\n<div class=\"paragraph\">\n<p>Finally, we instantiate a client, and use it to obtain a bucket instance. For those unfamiliar with Couchbase, buckets are a high-level organizational abstraction. You can think of them as something between a table and a full database.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>The bucket handle is all we need to run the loads against our clusters. A multi-cluster client bucket lets you specify timeouts for individual operations. For simplicity, I\u2019ve wrapped the interface in a facade, applying only one fixed timeout to every operation. This makes the interface identical to the standard one.<\/p>\n<\/div>\n<pre class=\"lang:java decode:true\">MultiClusterClient client = new MultiClusterClient(coordinator, detector);\r\n\r\nclient.authenticate(options.stringValueOf(\"id\"), options.stringValueOf(\"password\"));\r\nbucket = new BucketFacade(client.openBucket(bucketName, null), TIMEOUT, TimeUnit.MILLISECONDS);<\/pre>\n<h2 id=\"_wrapping_up\">Wrapping up<\/h2>\n<div class=\"paragraph\">\n<p>That\u2019s it for the new concepts needed to get off the ground with the MCA client. The rest of the code parses options, sets up the requested threads, and just runs them in loops. There are some statistics thrown in. I do make calls out to obtain the random data for writing and updating documents, so this code is not optimized for driving load. It can give some insight into the performance that Couchbase offers, though.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Again, to see this all in action, along with how the clusters behave, check out the demonstration during the second half of\u00a0<a title=\"https:\/\/event.on24.com\/eventRegistration\/EventLobbyServlet?target=reg20.jsp&amp;referrer=https%3A%2F%2Fwww.couchbase.com%2Fresources%2Fwebinars&amp;eventid=1569790&amp;sessionid=1&amp;key=86048A27BD53D35AFA6FFF8D43A09435&amp;regTag=&amp;sourcepage=register\" href=\"https:\/\/event.on24.com\/eventRegistration\/EventLobbyServlet?target=reg20.jsp&amp;referrer=https%3A%2F%2Fwww.couchbase.com%2Fresources%2Fwebinars&amp;eventid=1569790&amp;sessionid=1&amp;key=86048A27BD53D35AFA6FFF8D43A09435&amp;regTag=&amp;sourcepage=register\" rel=\"noopener noreferrer\">this webinar<\/a>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Version 1.0 of the MCA client was recently released. It\u2019s currently an Enterprise Edition only feature, as of this writing. To find out more and get access to the client, talk to a Couchbase sales representative (<a href=\"mailto:sales@couchbase.com\">sales@couchbase.com<\/a>). You can contact me for more information also, as described below.<\/p>\n<\/div>\n<h3 id=\"_postscript\">Postscript<\/h3>\n<div class=\"paragraph\">Couchbase is open source and free to try out.<\/div>\n<div class=\"paragraph\"><strong>Get started<\/strong> with <a title=\"https:\/\/www.couchbase.com\/get-started\" href=\"https:\/\/developer.couchbase.com\/tutorials\">sample code, example queries, tutorials, and more<\/a>.<\/div>\n<div class=\"paragraph\">Find more resources on our <a title=\"https:\/\/developer.couchbase.com\/community?utm_source=blogs&amp;utm_medium=link&amp;utm_campaign=blogs\" href=\"https:\/\/developer.couchbase.com\/community?utm_source=blogs&amp;utm_medium=link&amp;utm_campaign=blogs\">developer portal.<\/a><\/div>\n<div class=\"paragraph\">Follow us on Twitter <a title=\"https:\/\/twitter.com\/CouchbaseDev\" href=\"https:\/\/twitter.com\/CouchbaseDev\">@CouchbaseDev<\/a>.<\/div>\n<div class=\"paragraph\">You can post questions on our <a title=\"https:\/\/www.couchbase.com\/forums\/?utm_source=blogs&amp;utm_medium=link&amp;utm_campaign=blogs\" href=\"https:\/\/www.couchbase.com\/forums\/?utm_source=blogs&amp;utm_medium=link&amp;utm_campaign=blogs\">forums<\/a>.<\/div>\n<div class=\"paragraph\">And we actively participate on <a title=\"https:\/\/stackoverflow.com\/questions\/tagged\/couchbase\" href=\"https:\/\/stackoverflow.com\/questions\/tagged\/couchbase\">Stack Overflow<\/a>.<\/div>\n<div class=\"paragraph\">Hit me up on Twitter with any questions, comments, topics you\u2019d like to see, etc. <a title=\"https:\/\/twitter.com\/HodGreeley\" href=\"https:\/\/twitter.com\/HodGreeley\">@HodGreeley<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this post, I\u2019m going to take a look at a sample application that uses the Couchbase Server Multi-Cluster Aware (MCA) Java client. This client goes hand-in-hand with Couchbase\u2019s Cross-Data Center Replication (XDCR) capabilities. XDCR supports flexible replication of data [&hellip;]<\/p>\n","protected":false},"author":73,"featured_media":4519,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1815,1816,9415,1818],"tags":[2127,2126,1725],"ppma_author":[9042],"class_list":["post-4641","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-couchbase-server","category-xdcr","category-java","tag-disaster-recovery","tag-high-availability","tag-nosql-database"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client\" \/>\n<meta property=\"og:description\" content=\"In this post, I\u2019m going to take a look at a sample application that uses the Couchbase Server Multi-Cluster Aware (MCA) Java client. This client goes hand-in-hand with Couchbase\u2019s Cross-Data Center Replication (XDCR) capabilities. XDCR supports flexible replication of data [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-19T23:01:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:46:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/01\/HADR-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1673\" \/>\n\t<meta property=\"og:image:height\" content=\"1056\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Hod Greeley, Developer Advocate, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@HodGreeley\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hod Greeley, Developer Advocate, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/\"},\"author\":{\"name\":\"Hod Greeley, Developer Advocate, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/9b62593c8a13531e53d52fcd5aabbca4\"},\"headline\":\"Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client\",\"datePublished\":\"2018-02-19T23:01:36+00:00\",\"dateModified\":\"2025-06-14T03:46:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/\"},\"wordCount\":1326,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/01\/HADR-2.png\",\"keywords\":[\"Disaster Recovery\",\"High Availability\",\"NoSQL Database\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Couchbase Server\",\"Cross Data Center Replication (XDCR)\",\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/\",\"name\":\"Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/01\/HADR-2.png\",\"datePublished\":\"2018-02-19T23:01:36+00:00\",\"dateModified\":\"2025-06-14T03:46:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/01\/HADR-2.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/01\/HADR-2.png\",\"width\":1673,\"height\":1056},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/9b62593c8a13531e53d52fcd5aabbca4\",\"name\":\"Hod Greeley, Developer Advocate, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/21eb69cb5d4a401fb23b149e4f4e9e87\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/52d0018695c0ced0d1c68cf64a6195c81dbac03dce5983f98eb209e7c84350df?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/52d0018695c0ced0d1c68cf64a6195c81dbac03dce5983f98eb209e7c84350df?s=96&d=mm&r=g\",\"caption\":\"Hod Greeley, Developer Advocate, Couchbase\"},\"description\":\"Hod Greeley is a Developer Advocate for Couchbase, living in Silicon Valley. He has over two decades of experience as a software engineer and engineering manager. He has worked in a variety of software fields, including computational physics and chemistry, computer and network security, finance, and mobile. Prior to joining Couchbase in 2016, Hod led developer relations for mobile at Samsung. Hod holds a Ph.D. in chemical physics from Columbia University.\",\"sameAs\":[\"https:\/\/hod.greeley.org\/blog\",\"https:\/\/x.com\/HodGreeley\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/hod-greeley\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/","og_locale":"en_US","og_type":"article","og_title":"Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client","og_description":"In this post, I\u2019m going to take a look at a sample application that uses the Couchbase Server Multi-Cluster Aware (MCA) Java client. This client goes hand-in-hand with Couchbase\u2019s Cross-Data Center Replication (XDCR) capabilities. XDCR supports flexible replication of data [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/","og_site_name":"The Couchbase Blog","article_published_time":"2018-02-19T23:01:36+00:00","article_modified_time":"2025-06-14T03:46:29+00:00","og_image":[{"width":1673,"height":1056,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/01\/HADR-2.png","type":"image\/png"}],"author":"Hod Greeley, Developer Advocate, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@HodGreeley","twitter_misc":{"Written by":"Hod Greeley, Developer Advocate, Couchbase","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/"},"author":{"name":"Hod Greeley, Developer Advocate, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/9b62593c8a13531e53d52fcd5aabbca4"},"headline":"Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client","datePublished":"2018-02-19T23:01:36+00:00","dateModified":"2025-06-14T03:46:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/"},"wordCount":1326,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/01\/HADR-2.png","keywords":["Disaster Recovery","High Availability","NoSQL Database"],"articleSection":["Best Practices and Tutorials","Couchbase Server","Cross Data Center Replication (XDCR)","Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/","url":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/","name":"Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/01\/HADR-2.png","datePublished":"2018-02-19T23:01:36+00:00","dateModified":"2025-06-14T03:46:29+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/01\/HADR-2.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/01\/HADR-2.png","width":1673,"height":1056},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-high-availability-disaster-recovery-java-multi-cluster-aware-client\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Intro to Couchbase HA\/DR: Java Multi-Cluster Aware Client"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/9b62593c8a13531e53d52fcd5aabbca4","name":"Hod Greeley, Developer Advocate, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/21eb69cb5d4a401fb23b149e4f4e9e87","url":"https:\/\/secure.gravatar.com\/avatar\/52d0018695c0ced0d1c68cf64a6195c81dbac03dce5983f98eb209e7c84350df?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/52d0018695c0ced0d1c68cf64a6195c81dbac03dce5983f98eb209e7c84350df?s=96&d=mm&r=g","caption":"Hod Greeley, Developer Advocate, Couchbase"},"description":"Hod Greeley is a Developer Advocate for Couchbase, living in Silicon Valley. He has over two decades of experience as a software engineer and engineering manager. He has worked in a variety of software fields, including computational physics and chemistry, computer and network security, finance, and mobile. Prior to joining Couchbase in 2016, Hod led developer relations for mobile at Samsung. Hod holds a Ph.D. in chemical physics from Columbia University.","sameAs":["https:\/\/hod.greeley.org\/blog","https:\/\/x.com\/HodGreeley"],"url":"https:\/\/www.couchbase.com\/blog\/author\/hod-greeley\/"}]}},"authors":[{"term_id":9042,"user_id":73,"is_guest":0,"slug":"hod-greeley","display_name":"Hod Greeley, Developer Advocate, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/52d0018695c0ced0d1c68cf64a6195c81dbac03dce5983f98eb209e7c84350df?s=96&d=mm&r=g","author_category":"","last_name":"Greeley","first_name":"Hod","job_title":"","user_url":"https:\/\/hod.greeley.org\/blog","description":"Hod Greeley is a Developer Advocate for Couchbase, living in Silicon Valley. He has over two decades of experience as a software engineer and engineering manager. He has worked in a variety of software fields, including computational physics and chemistry, computer and network security, finance, and mobile. Prior to joining Couchbase in 2016, Hod led developer relations for mobile at Samsung. Hod holds a Ph.D. in chemical physics from Columbia University."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/4641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/73"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=4641"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/4641\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/4519"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=4641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=4641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=4641"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=4641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}