Sync Gateway multi-master replication


#1

Hi,

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

Regards,
-Felix.


#2

Yes it was designed to support multi-master replication:

See https://developer.couchbase.com/documentation/mobile/1.4/guides/sync-gateway/running-replications/index.html

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.


#3

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.

Regards,
-Felix.


#4

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


#5

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.


#6

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?

Regards,
-Felix.


#7

Unfortunately that’s outside the scope of our current replication
requirements.

See


#8

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
_sync:useremail:aircomdev02@gmail.com {“Username”:“accounts.google.com_117184761217583170836”}
Facebook Test User
_sync:useremail:lcafctxayc_1489006349@tfbnw.net {“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?


#9

Hi @felixfong,

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


#10

Hi,

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.

-Felix.