Sync Gateway multi-master replication



Does the current/future Sync Gateway support multi-master replication?



Yes it was designed to support multi-master replication:


Documents that are updated concurrently will end up in a conflicted state, where a winning branch will be deterministically chosen. The losing revision/branch can later be retrieved and promoted to the winning revision.


Thank you for the information.

Is there a maximum number of master it can support? We are looking at around 10+.

Update: In a star topology.



No. Really there is no master. Any two databases can sync with each other.


Nope, there is no fixed number or limitation.

In our automated test suite however, we are currently only testing two sync gateways replicating with each other.


Thank you for the information. I was able to setup two sync-gateway to do a single DB replication.

BTW, I am not seeing user account related document being replicated. Is there a way to make that happen?



Unfortunately that’s outside the scope of our current replication



We would like to link user private document (user profile, etc.) using username.

The link above suggested to use external authentication source (Google, Facebook, etc.) as a workaround. However, when I look at the user account document in DB created from Google and Facebook login, I am not sure how the username was picked.
Google OpenID Connect {“Username”:“”}
Facebook Test User {“Username”:“125583914635848”}

If I use the same Google account to login to a different sync_gateway, do I get assigned the same username in both sync_gateway?

If not, how do I ID user’s private document? Using Email address instead then?

On second thought, doesn’t the URL redirect will kill this approach?


Hi @felixfong,

Sorry for the long delay. Did you figure out what you needed with this?



Thank you for the reply. I was able to retrieve user ID by using Facebook Login and Google SignIn.
As for local login, I use a private bucket to store username and password which get replicated within the sync_gateway infra. Local login is done using a PHP page located on the user facing sync_gateway. Session info is then passed back using cookies to WebView.