Run these two tasks on a daily basis and prior to running your databases backup.

image

Running OpenStack on production can be difficult, so every optimizations are good to take :).

Basically, this script flushes expired tokens and moves deleted instance to other tables. You want to run this script only on one of your cloud controllers.

Depending on the amount of deleted instances that you get on a daily basis you’d like to modify the MAX_ROWS variable.

#!/bin/bash

# 1. Purge expired tokens
# 2. Move deleted instances to another table that you MUST not backup,
# unless you have data retention policies.

MAX_ROWS=100

logger -t keystone-cleaner "Starting token cleanup"
/usr/bin/keystone-manage token_flush
logger -t keystone-cleaner "Ending token cleanup"

logger -t deleted-rows-archiver "Starting archiving deleted rows"
/usr/bin/nova-manage db archive_deleted_rows --max_rows $MAX_ROWS
logger -t deleted-rows-archiver "Ending archiving deleted rows"

exit 0

Depending on the amount of deleted instances that you get on a daily basis you’d like to modify the MAX_ROWS variable.

Running these two tasks on a daily basis and ideally prior to running your databases backup is a good start.

Photo by tunelko // CC BY NC SA

Sébastien Han
Latest posts by Sébastien Han (see all)