couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tibor Gemes <tib...@gmail.com>
Subject _replicator and _users
Date Wed, 06 Feb 2013 09:17:01 GMT
Hi!

I have some problem with persistent continouos replicating the _users
database.

I've set up 2 servers, one local and one remote. I want to replicate the
_users database always. So I decided to add a document to the _replicator
database. This seems to be fine. But after I add a user document to the
_users database, the replicator keeps failing. It is in an endless
triggered-error-triggered-error cycle, but the replication does not take
place. If I call _replicate with the same json, then the replication
happens perfectly. If the two _users databases are in sync then the
replicator document settles in the triggered state.

Both REMOTE_URL and LOCAL_URL variables contains the proper basic auth
crendentials for the admin user.

Here are the steps to reproduce:
# add a replicator document
curl  -H "Content-type: application/json" -X PUT -d "{\"source\":
\"_users\", \"target\": \"${REMOTE_URL}/_users\", \"continuous\":  true,
\"user_ctx\": {\"name\": \"admin\", \"roles\": [\"admin\"]}}"
${LOCAL_URL}/_replicator/users:devices_users
{"ok":true,"id":"users:devices_users","rev":"1-010f00d464fba86a2820371c7bf04900"}

#verify the replicator document. It is in triggered state
curl -X GET  ${LOCAL_URL}/_replicator/users:devices_users
{"_id":"users:devices_users","_rev":"2-1df51063f46e4465ec1f6aaad7b03cd7","source":"_users","target":"http://admin:pwd@remote-db
:5984/_users","continuous":true,"user_ctx":{"name":"admin","roles":["admin"]},"owner":"admin","_replication_state":"triggered","_replication_state_time":"2013-02-01T12:57:05+01:00","_replication_id":"d78c7d9b7b215c6f2a3cb99c41f6be4c"}

# Add a user
curl -X PUT -d  '{ "type": "user",   "name": "u1",  "roles": ["u1"],
 "password": "XXX"}' ${LOCAL_URL}/_users/org.couchdb.user:u1
{"ok":true,"id":"org.couchdb.user:u1","rev":"1-f27f72a514abae8078740c792d5a0795"}

#check the replicator document, it is in error.
curl -X GET  ${LOCAL_URL}/_replicator/users:devices_users
{"_id":"users:devices_users","_rev":"3-c0ee7e14995877591740ee3191c147df","source":"_users","target":"http://admin:pwd@remote-db
:5984/_users","continuous":true,"user_ctx":{"name":"admin","roles":["admin"]},"owner":"admin","_replication_state":"error","_replication_state_time":"2013-02-01T12:57:52+01:00","_replication_id":"d78c7d9b7b215c6f2a3cb99c41f6be4c"}

# a few minutes later it is still in error, but the revision is 9.
curl -X GET  ${LOCAL_URL}/_replicator/users:devices_users
{"_id":"users:devices_users","_rev":"9-e16eff5cb75c2620a429ba0610bbf487","source":"_users","target":"http://admin:pwd@remote-db
:5984/_users","continuous":true,"user_ctx":{"name":"admin","roles":["admin"]},"owner":"admin","_replication_state":"error","_replication_state_time":"2013-02-01T12:58:08+01:00","_replication_id":"d78c7d9b7b215c6f2a3cb99c41f6be4c"}

What is wrong with this? How should I create a replication between these
two _users database which survives the server restart?


T

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message