How to fix auth error on CouchDB replication

Viewed 471

I've setup local/remote CouchDB servers and I'd like to replicate between them.

Curling on each works fine so I know both databases are running ok:

curl -u admin:password https://remote.host.net/db_name - works

curl -u admin:password http://localhost:5984/db_name - works

However, when I try and setup replication it borks. This is the command used to setup the replication:

curl -u admin:password -X POST http://localhost:5984/_replicate -d '{"source":"https://admin:password@remote.host.net/db_name", "target":"http://admin:password@localhost:5984/db_name"}' -H "Content-Type: application/json"

Error message:

{"error":"replication_auth_error","reason":"{session_request_failed,\"https://remote.host.net/_session\",\n\"admin\",\n{conn_failed,{error,nxdomain}}}"}

Anyone have any ideas what's going wrong here?

2 Answers

I faced the same problem and adding "continuous": true to the request body, returns with a "ok":true.

From the docs, continuous should be used only when you want the replication to be triggered always the source changes, I don't know why the error when it is not included.

[edit]

Even with the success response, the data is not been copied. So we use this script to achieve the replication https://gist.github.com/Aybee5/fba07b06b94442a529ebae5465b77737

Yup.. I know its been almost a year since I posted the original question but I just ran into a similar issue and solved it by using the source_proxy/target_proxy kwargs in the replication request.

I can't remember if I was behind a proxy last time unfortunately.

Related