You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Martin Hewitt <ma...@thenoi.se> on 2012/04/05 16:46:50 UTC

Best practice for backing up CouchDB

Hi all,

I was just wondering if anyone had any hints, tips or tricks for doing live, incremental backups of a CouchDB install?

I'm assuming that the data are in the .couch files, and the generated views are in the .db_name_design folders, ergo, I should make sure that the .couch files are totally safe, and the views can be backed up, to a degree, but can always be regenerated from the .couch files?

Are there any access/locking/permissions issues that anyone's come across?

Many thanks,

Martin

Re: Best practice for backing up CouchDB

Posted by Mark Hahn <ma...@hahnca.com>.
>  Anyway, I didn't know that you could just copy the db files that easily.


Yes.  In development I take snapshots by just copying the db file while it
is live.  Then I restore snapshots just by copying the old file over the
newer one.  Then I do a db restart and like magic it is restored.

On Thu, Apr 5, 2012 at 10:33 AM, Matthieu Rakotojaona <
matthieu.rakotojaona@gmail.com> wrote:

> On Thu, Apr 5, 2012 at 6:01 PM, Mark Hahn <ma...@hahnca.com> wrote:
> > Good backup gives you the ability to go back to an older version of data.
> >  Replication does not allow this.
>
> Wouldn't a _changes feed provide you with the same kind of information
> ? Because rsync'ing the db file, only retrieving the diff from the
> last time we checked it, looks a lot like getting
>     _changes?since=N
> with the drawbacks that you would have to store the
> last_fetched_seqnum somewhere and that you couldn't compress it
> directly.
>
> Anyway, I didn't know that you could just copy the db files that
> easily. Yet Another great feature !
>
> --
> Matthieu RAKOTOJAONA
>

Re: Best practice for backing up CouchDB

Posted by Matthieu Rakotojaona <ma...@gmail.com>.
On Thu, Apr 5, 2012 at 6:01 PM, Mark Hahn <ma...@hahnca.com> wrote:
> Good backup gives you the ability to go back to an older version of data.
>  Replication does not allow this.

Wouldn't a _changes feed provide you with the same kind of information
? Because rsync'ing the db file, only retrieving the diff from the
last time we checked it, looks a lot like getting
     _changes?since=N
with the drawbacks that you would have to store the
last_fetched_seqnum somewhere and that you couldn't compress it
directly.

Anyway, I didn't know that you could just copy the db files that
easily. Yet Another great feature !

--
Matthieu RAKOTOJAONA

Re: Best practice for backing up CouchDB

Posted by Mark Hahn <ma...@hahnca.com>.
Good backup gives you the ability to go back to an older version of data.
 Replication does not allow this.  I also copy the db files and rotate them
like logs.

Re: Best practice for backing up CouchDB

Posted by Martin Hewitt <ma...@thenoi.se>.
Thanks Alon, I thought I'd seen this question asked before, but Google defeated me!

Martin 

On 5 Apr 2012, at 16:21, Alon Keren wrote:

> Hi Martin,
> 
> I asked this question a while back, and the resulting discussion is quite
> informative:
> http://comments.gmane.org/gmane.comp.db.couchdb.user/11410
> 
>  Alon
> 
> On 5 April 2012 17:46, Martin Hewitt <ma...@thenoi.se> wrote:
> 
>> Hi all,
>> 
>> I was just wondering if anyone had any hints, tips or tricks for doing
>> live, incremental backups of a CouchDB install?
>> 
>> I'm assuming that the data are in the .couch files, and the generated
>> views are in the .db_name_design folders, ergo, I should make sure that the
>> .couch files are totally safe, and the views can be backed up, to a degree,
>> but can always be regenerated from the .couch files?
>> 
>> Are there any access/locking/permissions issues that anyone's come across?
>> 
>> Many thanks,
>> 
>> Martin


Re: Best practice for backing up CouchDB

Posted by Alon Keren <al...@gmail.com>.
Hi Martin,

I asked this question a while back, and the resulting discussion is quite
informative:
http://comments.gmane.org/gmane.comp.db.couchdb.user/11410

  Alon

On 5 April 2012 17:46, Martin Hewitt <ma...@thenoi.se> wrote:

> Hi all,
>
> I was just wondering if anyone had any hints, tips or tricks for doing
> live, incremental backups of a CouchDB install?
>
> I'm assuming that the data are in the .couch files, and the generated
> views are in the .db_name_design folders, ergo, I should make sure that the
> .couch files are totally safe, and the views can be backed up, to a degree,
> but can always be regenerated from the .couch files?
>
> Are there any access/locking/permissions issues that anyone's come across?
>
> Many thanks,
>
> Martin

Re: Best practice for backing up CouchDB

Posted by Martin Hewitt <ma...@thenoi.se>.
Hi Matthieu,

We could, and, indeed, we do. Our primary backup strategy is the fact we run a cluster of BigCouch machines, geographically dispersed, to hopefully guard against physical incursions, datacentre outages and connectivity issues.

This question was borne from a specific client request that we incrementally send them a snapshot of their databases. Quite why they want this, I have no idea, but battles must be picked carefully, so here I am!

Martin

On 5 Apr 2012, at 16:20, Matthieu Rakotojaona wrote:

> On Thu, Apr 5, 2012 at 4:46 PM, Martin Hewitt <ma...@thenoi.se> wrote:
>> Are there any access/locking/permissions issues that anyone's come across?
> 
> Dumb question : couldn't you backup your db directly with another
> instance of couchdb via its replication API ?
> 
> While doing what you're asking might work, I believe this is not what
> couchdb was built for. In fact, I see it more like what a 'dd' would
> do, while a standard couchdb replication is more like a 'cp'. It is a
> higher-level operation, but in the end, what you're interested in are
> the documents.
> --
> Matthieu RAKOTOJAONA


Re: Best practice for backing up CouchDB

Posted by Matthieu Rakotojaona <ma...@gmail.com>.
On Thu, Apr 5, 2012 at 4:46 PM, Martin Hewitt <ma...@thenoi.se> wrote:
> Are there any access/locking/permissions issues that anyone's come across?

Dumb question : couldn't you backup your db directly with another
instance of couchdb via its replication API ?

While doing what you're asking might work, I believe this is not what
couchdb was built for. In fact, I see it more like what a 'dd' would
do, while a standard couchdb replication is more like a 'cp'. It is a
higher-level operation, but in the end, what you're interested in are
the documents.
--
Matthieu RAKOTOJAONA