Git Product home page Git Product logo

Comments (7)

nickva avatar nickva commented on August 20, 2024 1

Creating Replications

There are two ways to create replications:

  1. POST-ing to the /_replicate HTTP endpoint. Let's call these transient.

  2. Creating a document in the _replicator database. Any database which ends in the /_replicator will work as a replicator database. Let's call these persistent.

Each are slightly different. For the transient ones there is no document backing the replication job. If the server crashes the job will just disappear. When jobs finish there is no way to query their state. This method of replicating was implemented initially.

Persistent ones are backed by a document in a _replicator db. They will persist across server restarts and it is possible to inspect their state after they finished.

The reason there are two is because transient ones where implemented first and were kept for backwards compatibility and are actually useful in some cases when programmatically creating replication jobs.

Monitoring Replications

  1. Transient replications can be monitored via the /_active_tasks endpoint or the /_scheduler/jobs endpoint. It might take a a few minutes between the time a replication is created and it appears as a replication job in these endpoints.

http://docs.couchdb.org/en/latest/api/server/common.html#scheduler-jobs

  1. Permanent replications can be monitored via the /_scheduler/docs endpoint as well as the /_scheduler/jobs and /_active_tasks. The /_scheduler/docs is preferred as it will show the state of the replication document before it becomes a replication job. Some documents could be invalid and could not become a replication job. Others might be delayed because they are fetching say the filter code from a slow source database.

http://docs.couchdb.org/en/latest/api/server/common.html#get--_scheduler-docs-replicator_db

Replication States

Replication documents become replication jobs and then replication jobs do all the replication work. There are a number of states a replication goes through so this chart might be helpful:

http://docs.couchdb.org/en/latest/replication/replicator.html#replication-states

from couchdb-documentation.

ufobat avatar ufobat commented on August 20, 2024 1

what about
{"id":"_design/_replicator","key":"_design/_replicator","value":{"rev":"1-85a961d0d9b235b7b4f07baed1a38fda"}} which is a default document in the _replication db?

from couchdb-documentation.

ufobat avatar ufobat commented on August 20, 2024

FYI

<vatamane> ufobat: try checking  _scheduler/docs/ instead
<vatamane> _replicate endpoint is to create replications that are not backed by a document from the _replicator database
<vatamane> also note there is  the http /_replicate endpoint and a _replicator database I think you might be confusing the two
<ufobat> vatamane, when if i only use _replicator db? 
<ufobat> i can POST and GET from there?
<ufobat> i just care about the configruation, not of the replication results/states
<vatamane> you can create replications by creating documents in the _replicator database
<ufobat> vatamane, i actually did :-( 
<vatamane> these replication will persist even after a server is restarted (unlike replication from the _replicate endpoint)
<vatamane> to check the status of your replication try http://docs.couchdb.org/en/stable/api/server/common.html#scheduler-docs
<ufobat> because of my confusion i wrote https://github.com/apache/couchdb-documentation/issues/346
<vatamane> thanks ufobat, I'll update the ticket with more info
<ufobat> is the scheduler-doc information about which documents in which db where replicated?
<ufobat> my db is currently empty
<vatamane> _scheduler/doc allows you to track the state of replications which are backed by a document in a _replicator database
<ufobat> ah and _scheduler/jobs is for the _replicate api?
<vatamane> _scheduler/jobs tracks replication jobs that started broth from the _replicate endpoint and by creating documents in the _replicator db
<ufobat> and this applys also if i have a "custom_replicator" database, because docs says i could use one ( which would fit perfectly for my script approach, cause i wouldnt see other replications that dont belong to me)
<vatamane> you could use one, yeah, any database that end with the /_replicator suffix will work as a replicator db
<vatamane> when you query _scheduler/docs you'd have to pass that database name in the path explicitly like say _scheduler/docs/mycustom/_replicator
<ufobat> i think thats missin in the documentation as well

from couchdb-documentation.

ufobat avatar ufobat commented on August 20, 2024
<vatamane> that's expected it's automatically created and is used to validate replicate documents created in that database
<rnewson> it enforces correctness of the docs, it's an internal detail really
<ufobat> i am just asking because when i do a get on _replicator/_all_docs i need to know that this is there in order to skip over it
<vatamane> you can skip over it
<ufobat> because "remove anything thats not my desired replication configuration" would be wrong
<ufobat> ty :)

from couchdb-documentation.

wohali avatar wohali commented on August 20, 2024

@ufobat do you have everything you need to write a PR?

from couchdb-documentation.

ufobat avatar ufobat commented on August 20, 2024

@wohali I think I do, thank you :-)

from couchdb-documentation.

ufobat avatar ufobat commented on August 20, 2024

I am not sure if and where i should mention the _design/_replicator document. any idea?

from couchdb-documentation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.