Skip to Content

Automatically compact CouchDB databases in version 0.11.x

CouchDB databases on version 0.11.x swell very fast. They should be compacted daily for best performance and space usage. Here is my script that could be run in cron and will compact all databases:

DBS=`curl -sS -X GET http://$IP:5984/_all_dbs | sed -r "s/([,\"[])|(\])+/ /g"`

for d in $DBS;
    curl -H "Content-Type: application/json" -X POST http://$IP:5984/$d/_compact

More informations about compacting could be found here (also for version 1.2.x).

comments powered by Disqus