CouchDB Local and Local Installation 2-way replication

I am trying to synchronize a database on a local CouchDB installation (v 1.3.1 on Mac) and a database on Cloudant with master-master replication.

In my local Futon http://localhost:5984/_utils I configured Replicator to replicate my local database to Cloudant. Everything works fine, replicating from a local database to Cloudant, but not backward. If the data changes in the Cloudant database are not replicated to my local database.

Local β†’ Cloudant = works

Cloudant -> Local = not working

Can this be done? Can anyone help?

Thanks!

+6
source share
2 answers

Finally, I realized that I only need to configure two replicas from my local CouchDB.

Here are the replications:

 { "source":"https://username: pwd@username.cloudant.com /cloud_db", "target":"http://username: pwd@localhost :5985/local_db" } { "source":"http://username: pwd@localhost :5985/local_db", "target":"https://username: pwd@username.cloudant.com /cloud_db" } 

Now at http://localhost:5984/_utils/status.html two replications are performed.

Please note that I added the username and password to the local connection. This is because you need to be an authorized user to replicate project documents.

Thanks a lot to Mike, your answer really helped!

+5
source

Can you try to provide full URLs for source and target? I think it will look like this:

 #create the replicator database for your local server curl -X PUT 'http://127.0.0.1:5984/_replicator' 

then download this document:

 { "source":"https://username: pwd@username.cloudant.com /source_db", "target":"http://127.0.0.1:5985/target_db" } 

Then you should be able to control this with:

 http://127.0.0.1:5984/_active_tasks 

If this does not work for you, can you copy / paste:

  • document body in _replicator database
  • grep log file for anything with _replication

In addition, there is a classic β€œgetcha”, which, I think, you need β€œwriter's” permissions for both the source and target databases. This may seem strange, but this is because the replicator saves the control point documents for both the source and the target, so the next time you ask to replicate, it should not start from scratch.

+4
source

Source: https://habr.com/ru/post/949832/


All Articles