You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Tibor Gemes <ti...@gmail.com> on 2013/02/06 10:17:01 UTC
_replicator and _users
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
Re: _replicator and _users
Posted by Tibor Gemes <ti...@gmail.com>.
On 6 February 2013 10:33, Robert Newson <ro...@gmail.com> wrote:
> _admin for the role not admin?
>
Yes. Thx. You are completely right.
Just a few hours of my life was sacrified for this stupid err. I'm crying.
T
Re: _replicator and _users
Posted by Robert Newson <ro...@gmail.com>.
_admin for the role not admin?
Sent from my iPhone
On 6 Feb 2013, at 09:17, Tibor Gemes <ti...@gmail.com> wrote:
> 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