You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Nils Breunese <N....@vpro.nl> on 2011/02/02 17:53:59 UTC

CouchDB maintenance script

Hello,

CouchDB requires some maintenance from time to time, so I created a Python script using Benoit's Couchdbkit library to do the following for one or more CouchDB instances:

* Compact all databases
* Compact all views for all databases
* Clean up all views for all databases

Note that all these tasks are started at once, so if you have a lot of databases/views/data, running this script might ask a lot of your server's resources. If anyone has a great idea to do this in a 'better' way, let me know. (Polling the server for compact_running? Is this also available for compacting views? Maybe just a dumb sleep before starting a next job?)

You can find the code at https://github.com/vpro/couchdb_maintenance under an MIT license. I run it daily using cron myself. I hope this is useful for others as well.

Nils.
------------------------------------------------------------------------
 VPRO   www.vpro.nl
------------------------------------------------------------------------

Re: CouchDB maintenance script

Posted by Zachary Zolton <za...@gmail.com>.
And, if Ruby's more your cup of tea, I've got my own version of a
CouchDB maintenance script:

https://github.com/zdzolton/couch-cleanup

I've had this running on a weekly cron job to reclaim space for a few
months now, and it hasn't given me any trouble.

@Nils let's see if we can trade some ideas and make better scripts! (^_^)


Cheers,

Zach


On Wed, Feb 2, 2011 at 10:53 AM, Nils Breunese <N....@vpro.nl> wrote:
> Hello,
>
> CouchDB requires some maintenance from time to time, so I created a Python script using Benoit's Couchdbkit library to do the following for one or more CouchDB instances:
>
> * Compact all databases
> * Compact all views for all databases
> * Clean up all views for all databases
>
> Note that all these tasks are started at once, so if you have a lot of databases/views/data, running this script might ask a lot of your server's resources. If anyone has a great idea to do this in a 'better' way, let me know. (Polling the server for compact_running? Is this also available for compacting views? Maybe just a dumb sleep before starting a next job?)
>
> You can find the code at https://github.com/vpro/couchdb_maintenance under an MIT license. I run it daily using cron myself. I hope this is useful for others as well.
>
> Nils.
> ------------------------------------------------------------------------
>  VPRO   www.vpro.nl
> ------------------------------------------------------------------------
>