5

In the last months, we've been charged for a lot of HTTP requests we were not expecting on Cloudant. By looking at CouchDB console locally, I found out that for each continuous replication a GET request is issued every 5 seconds or so.

I have stopped all the continuous replications I could find in Futon and I did the same for every Cloudant accounts we have. By looking at Cloudant's dashboard, I have seen a reduction of GET requests (many thousands), but it did not went down to a reasonable level. So there must be some continuous replications left, but I cannot find them.

How can I find and stop the remaining replications?

mll
  • 505
  • 1
  • 4
  • 14
  • Why don't you contact their support department? I had really good luck with it in the past. – WiredPrairie Aug 15 '13 at 15:03
  • I did contact support. They respond quickly usually, but I’ve been waiting for some days now. – mll Aug 15 '13 at 15:16
  • I don't know -- try again? :) As its very infrastructural in nature, I'd think they'd be the best ones to answer your direct question. – WiredPrairie Aug 15 '13 at 15:38

1 Answers1

1

To identify continuous replications that may be hidden to the user, the best way is to query a curl command, invoke _active_tasks, and apply a jq filter to display only those tasks of type "replication".

That is to say, in the command line, run a command of the following form:

curl 'https://username:password@username.cloudant.com/databasename/_active_tasks | jq 'map(select(.type == "replication"))'

The same methodology can be applied to retrieve other active tasks (view_compaction, database_compaction, etc.)


That said, in general, Cloudant-based replication is much smoother when using the _replicator database. To do so:

1) As an initial one-time task, create the database:

 https://username.cloudant.com/_replicator 

2) Then, create a document for every replication. If you have "continuous":true in the doc it will be treated as continuous.

3) Then, to cancel the replication you simply delete the document.

All of the above commands (e.g. creating and deleting documents) are well documented on Cloudant's website as well as throughout Stack Overflow, so please refer there for further details.

Finally, it is imperative to add the usr_ctx field so that the replication gets triggered and run within your user context. This is critical so that it shows up when you query _active_tasks, otherwise it'll run anonymously and only show up in the _active_tasks if queried by an admin. This is precisely what happened in the case of the original poster.

  • I tried querying _active_task (`curl 'https://username:password@username.cloudant.com/_active_tasks'`) and I got back an empty array. – mll Aug 16 '13 at 13:51
  • curl `'https://username:password@username.cloudant.com/databasename/_active_tasks'` returned `{"error":"not_found","reason":"missing"}`. – mll Aug 16 '13 at 14:00
  • What do I have to do to be an admin as in "[...] if queried by an admin."? – mll Aug 16 '13 at 14:05
  • 1
    @jake: What if a continuous pull replication was created on another server than Cloudant, would it show up in Cloudant's _active_tasks? – airpaulg Aug 16 '13 at 14:05
  • 1
    @airpaulg: Unfortunately not, since it's not a task your instance is undertaking. If instances other than your own are replicating from yours, and you don't want them to, you could set permissions in the database's dashboard to more strictly limit who can read and write from the database. – garbados Aug 19 '13 at 14:24