Skip to navigation
Bash script to compact all couchdb databases
07.03.18
bash script to compact all couchdb databases #!/bin/bash #this will connect to a remote couchdb, get all its databases and create on the local couchdb the replication docs TARGET='http://127.0.0.1:5984' TARGET_PASS='foo:bar' TARGET_BASE64=`echo -n $TARGET_PASS | base64` dbs=$(curl -H "Authorization: Basic $TARGET_BASE64" -s $TARGET'/_all_dbs' | python -c "import sys, json; s= ' '.join(json.load(sys.stdin)).replace('_global_changes','').replace('_replicator','').replace('_users',''); print(s) ") for DB in $dbs; do curl -X POST $TARGET/$DB/_compact \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -H "Authorization: Basic $TARGET_BASE64" \ done
https://myridia.com/docs.couchdb.org/en/latest/api/database/compact.html
Reply
Anonymous
Information Epoch 1775147279
Live free or die.
Home
Notebook
Contact us