Created
November 13, 2018 10:43
-
-
Save wido/7f936c5897634ed088511d111f576e5e to your computer and use it in GitHub Desktop.
Remove old RADOS Gateway Bucket Indexes from Ceph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for bucket in $(radosgw-admin bucket list | jq -r .[]); do | |
bucket_id=$(radosgw-admin metadata get bucket:${bucket} | jq -r .data.bucket.bucket_id) | |
marker=$(radosgw-admin metadata get bucket:${bucket} | jq -r .data.bucket.marker) | |
for instance in $(radosgw-admin metadata list bucket.instance | jq -r .[] | grep "^${bucket}:" | grep -v ${bucket_id} | grep -v ${marker}| cut -f2 -d':'); do | |
echo "${bucket}: ${instance}" | |
radosgw-admin bi purge --bucket=${bucket} --bucket-id=${instance} | |
radosgw-admin metadata rm bucket.instance:${bucket}:${instance} | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment