Skip to content

Instantly share code, notes, and snippets.

@wido
Created November 13, 2018 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wido/7f936c5897634ed088511d111f576e5e to your computer and use it in GitHub Desktop.
Save wido/7f936c5897634ed088511d111f576e5e to your computer and use it in GitHub Desktop.
Remove old RADOS Gateway Bucket Indexes from Ceph
#!/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