diff options
author | varac <varacanero@zeromail.org> | 2014-03-13 19:55:12 +0100 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2014-03-13 19:55:12 +0100 |
commit | b659ca769d47ff6c9512c52cc81ffd32c70a1a88 (patch) | |
tree | 84aa00de9e135a8e96a9099d240fc6c529941c9b | |
parent | b1dd2f2ea8fc435a5d1cd6781375751bda56b198 (diff) |
added bigcouch_compact_all_shards.sh (#4798)
-rwxr-xr-x | bigcouch_compact_all_shards.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/bigcouch_compact_all_shards.sh b/bigcouch_compact_all_shards.sh new file mode 100755 index 0000000..2d46a9b --- /dev/null +++ b/bigcouch_compact_all_shards.sh @@ -0,0 +1,29 @@ +#!/bin/sh -e + +SHARDSDIR='/opt/bigcouch/var/lib/' +NETRC='/etc/couchdb/couchdb.netrc' +SIZE='1M' + +#shards=`find ${SHARDSDIR}/shards/ -name '*5a66957c1c93aa637d241484912c61f8*' -size +${SIZE}` +shards=`find ${SHARDSDIR}/shards/ -type f -size +${SIZE}` + +echo +echo "Disk usage before: `df -h $SHARDSDIR`" +echo + +for i in $shards +do + shard=`echo $i | sed "s/^.*shards\///" | cut -d'/' -f 1` + db=`basename $i .couch` + #echo $shard + #echo $db + echo -n "compacting ${i}:" + curl -X POST --netrc-file $NETRC -H "Content-Type: application/json" "http://127.0.0.1:5986/shards%2F${shard}%2F${db}/_compact" + sleep 1 +done + +echo +echo "Disk usage after: `df -h $SHARDSDIR`" +echo + +echo "$0 ran successful" |