Synchronizing buckets

I have an MVC project that I fill my bucket “default” and get data from its views. I have 2 couchbase servers which are synchronized. in my servers, sync_gateway buckets are created.

This couchbase servers will be used with both iOS and Android. Mobile side will be handled by some other guys here, my only duty now is to carry my docs from default bucket to sync_gateway bucket and keep these two synchronized…
I thought I was gonna do it by installing sync_gateway.exe and stuff but my boss just came in and said I shouldn’t be using them, it’s already connected and the rest of it is mobile guys’ thing. He said I should create channels(?) between sync_gateway and default bucket and etc. I don’t really understand what I should do now since I’m so new on all this couchbase thing. I will be doing this syncronizing thing it in my MVC project, I guess.

Anybody can help me with that? Thanks.

No one?
I need help as soon as possible…


You might try asking your questions in the Mobile section, Questions about how to configure replication with the sync gateway will probably get a better response there, since it’s not really .Net specific.

You might also try this document about channels in the sync gateway.


1 Like

@btburnett3 Hello, thanks for the response. I actually asked my question in mobile section at first, but they only told me how to configure sync_gateway’s config and other stuff. They couldn’t help me with carrying docs from"default" bucket to “sync_gateway” bucket simultaneously. Do you mean this is something that the mobile department guys’ should do? I could only fill my “default” bucket with .NET so far.

EDIT: After I wrote this, by changinf my serviceconfig.json I copied all my docs from defult bucket to sync_gateway bucket :

  "log":["CRUD+", "REST+", "Changes+", "Attach+", "Shadow"],
                function (doc) {
                channel (doc.channels);
        "users": {
                "GUEST": {
                    "disabled": false,
                    "admin_channels": ["*"]
        "shadow": {
                "server": "http:/host:8091",
                "bucket": "default"

But, then I tried to upsert new things into my default bucket docs and they didn’t appear in sync_gateway docs. I guess I should do sommething else to keep them synced? Any ideas?


One trick you might consider is using XDCR. You can use this to keep two buckets in sync, even two buckets on the same cluster. Documentation link below:


1 Like

Thanks @btburnett3, I guess this might work.


Additional issues apply when using XDCR with buckets that are used by Sync Gateway.

Sync Gateway maintains a local atomic sequence document _sync:seq.

If this is overridden by XDCR replication on a target CBS cluster the behaviour of Sync Gateway instances running against that cluster is undefined.

For replication between Sync gateway instances running against different Couchbase Server clusters we have developed sg-replicate.

The sg-replicate functionality is also available as a new _replicate endpoint (on SG repo master) and will be included in the next formal SG release.

@andy Thanks, yes, I found out XDCR was not the proper solution. It corrupts the documents.