开发者

Listing active replications in couchdb 1.1.0

I am bootstraping replications in couchdb by POSTing to localhost:5984/_replicate. This URL only accepts POST requests.

There is also a second URL: localhost:5984/_replicator, which accepts PUT, GET and DELETE requests.

When I configure a replication POSTing to _replicate, it gets started, but I can not get information about it. It is also not listed in _replicator.

  • How can I get the list of active replications?
  • How can I cancel an active replication?

Edit: how to trigger replications with the _replicator method.

Thanks to comments by JasonSmith, I got to the following solution: PUTting to _replicator requires using full url (including authentictation credentials) for the target database. This is not the case when using the _replicate url, which is happy getting just the name of the target database (I am talking here about pull replications). The reason, as far as I can tell, is explained 开发者_开发技巧here (see section 8, "The user_ctx property and delegations")


The original API was a special URL, /_replicate where you tell Couch what to do and it tells you the result. However, the newer system is a regular database, called /_replicator and you create documents inside it telling Couch what to do. The document format is the same as the older _replicate format, however CouchDB will update the document as the replication proceeds. (For example, it will add a field "state":"triggered" or "state":"complete", etc.)

To get a list of active replications, GET /_active_tasks as the server admin. For example (formatted):

curl http://admin:secret@localhost:5984/_active_tasks
[ { "type": "Replication"
  , "task": "`1bea06f0596c0fe6a1371af473a95aea+create_target`: `http://jhs.iriscouch.com/iris/` -> `iris`"
  , "started_on": 1315877897
  , "updated_on": 1315877898
  , "status": "Processed 83 / 119 changes"
  , "pid": "<0.224.0>"
  }

, { "type": "Replication"
  , // ... etc ...
  }
]

The wiki has instructions to cancel CouchDB replication. Basically, you want to specify the same source and target and also add "cancel":true.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜