Sync gateway with XDCR

79 views
Skip to first unread message

Brett Harrison

unread,
Mar 24, 2015, 1:24:35 PM3/24/15
to mobile-c...@googlegroups.com
Can I use XDCR to update couchbase (that uses the sync gateway) to be identical in several datacenters?

Our database is read-only to the user.  The only updates that happen will be on the admin port.  With XDCR turned on would the data propagate properly to the other data centers and be presented by the sync gateway in that location?

Traun Leyden

unread,
Mar 24, 2015, 2:18:04 PM3/24/15
to mobile-c...@googlegroups.com
The only safe way to use XDCR is if you have a single master Couchbase Cluster + Sync Gateway that accepts writes, and all of your other CBCluster + Sgw are read-only.  (Sync Gateway doesn't currently have a read-only mode to my knowledge, not sure about Couchbase Server).  Otherwise, since XDCR is not aware of the _sync metadata field in the documents, it will essentially corrupt documents.  

Having said that, we've done zero testing of XDCR + Sync Gateway in-house so far, so you'd be in unchartered territory.

Another option is to try sg-replicate, which uses the ReST replication protocol to sync between Sync Gateways in an eventually consistent fashion.  You would be able to have all your Couchbase Clusters + Sync Gateways accept writes, but:

* They would be eventually consistent -- there will be a delay when docs make it from one cluster to the other.

* You might end up with document conflicts.  Sync Gateway is architected to handle these gracefully, so they won't cause any issues, but there will be more work on your part to handle these conflicts in your application.

sg-replicate is still fairly alpha / POC, but has undergone some real world dogfood testing and seemed to work fine.  Since most of the work is handled on the Sync Gateway side, it's a fairly simple tool that just shuttles documents back and forth.




On Tue, Mar 24, 2015 at 10:24 AM, Brett Harrison <brett.h...@zyamusic.com> wrote:
Can I use XDCR to update couchbase (that uses the sync gateway) to be identical in several datacenters?

Our database is read-only to the user.  The only updates that happen will be on the admin port.  With XDCR turned on would the data propagate properly to the other data centers and be presented by the sync gateway in that location?

--
You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/9df5640d-4c5e-4d30-b959-8751ccd215ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brett Harrison

unread,
Mar 24, 2015, 3:02:01 PM3/24/15
to mobile-c...@googlegroups.com
If I use the master -> read-only couchbase method with XDCR, would the sync gateway connected to the read-only couchbase instances need to restarted to pick up the changes?

Traun Leyden

unread,
Mar 24, 2015, 3:05:44 PM3/24/15
to mobile-c...@googlegroups.com
Nope, no restarting should be necessary.  If there is, it's a bug.

Reply all
Reply to author
Forward
0 new messages