Thursday, August 18, 2011

CouchDB replicate with authorization

(Parts of this are documented elsewhere, but the more on the googs the better...)

The CouchDB Replicator in Futon is a handy tool, but doesn't seem to work when the target is anything but an Admin Party (everyone is admin). This is a bummer, since presumably no production systems are such a party.

No matter: you can do the same thing with a new document in the _replicate database. Just make a new doc (POST or in Futon):

There are some options:
  "continuous": true     // keep replicating forever as new documents arrive

"create_target": true // allow creation of target_db_name if necessary

When you (re)load this document, you'll see that CouchDB has added some new fields, _replication_id, _replication_state, _replication_state_time. If it worked, the _replication_state should be "triggered".

If the _replication_state is "error", you'll have to go look in the CouchDB server logs for the reason.

No comments:

Post a Comment