Created
January 17, 2024 16:43
-
-
Save lunitrixx/da2fe6042c864fd8f7c8e9194757832c to your computer and use it in GitHub Desktop.
Ceph RADOS Gateway - Remove bucket indexes
This file contains 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