couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Hirst <paul.hi...@sophos.com>
Subject Re: Replicate all databases
Date Fri, 25 Mar 2011 10:56:58 GMT
I decided to solve this by encoding what needed to be done in a
database, with a separate document for each couch server. Each couch
server has a cron script run every minute which gets it's config from
the database and acts upon it. The config can specify which databases
needs replicating to where and also what views (or actually design
documents) need triggering and how often.

The script is written in Perl and it's here
http://friendpaste.com/4lSkgZR0xdAJ2Od42U0Yiz
An example config document is here
http://friendpaste.com/3MQMNwrNSwjfDRVmuXjGRM

And I run it from cron every minute as

/usr/local/sbin/couch_maint http://uk-couch.yellow.sophos:5984/couch_config/uk-couch1.yellow.sophos

so the provided argument is the URL of the document it needs to grab and
act upon. I get puppet to fill in the correct hostname for the machine
when it configures the cron entry rather than have the script look up
the hostname itself. This seemed easier in my environment.

It only does push replication and sets it every minute. The view
generation triggers are configurable in the configuration file (ie you
can say every '1 minute' or every '2 days').

If anyone does take a look at this please be kind and consider I never
intended to let anyone else see it :-)

On Fri, 2011-03-25 at 09:53 +0000, Martin Hewitt wrote:
> I was hoping to be able to just configure continual replication of all databases, but
it looks like it'll need some sort of application layer intervention.
>
> Martin
>
> Sent from my iPhone
>
> On 24 Mar 2011, at 20:18, Nils Breunese <N.Breunese@vpro.nl> wrote:
>
> > I don't believe there is, but you can check /_all_dbs and loop over that list.
> >
> > Nils.
> > ________________________________________
> > Van: Martin Hewitt [martin@thenoi.se]
> > Verzonden: donderdag 24 maart 2011 17:40
> > Aan: user@couchdb.apache.org
> > Onderwerp: Replicate all databases
> >
> > Hi all,
> >
> > I'm setting up a failover server for an app that runs CouchDB and was wondering
if there was a special endpoint for simply replicating all databases to another server?
> >
> > Thanks,
> >
> > Martin
> > ------------------------------------------------------------------------
> > VPRO   www.vpro.nl
> > ------------------------------------------------------------------------



Sophos Limited, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United Kingdom.
Company Reg No 2096520. VAT Reg No GB 991 2418 08.

Mime
View raw message