Make vacuum script more comprehensive
This commit is contained in:
27
roles/pvc/templates/patroni/pvcdns-vacuum.j2 → roles/pvc/templates/pvc/pvc-vacuum.j2
Normal file → Executable file
27
roles/pvc/templates/patroni/pvcdns-vacuum.j2 → roles/pvc/templates/pvc/pvc-vacuum.j2
Normal file → Executable file
@ -1,6 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Daily vaccuum script for PostgreSQL databases
|
||||
# {{ ansible_managed }}
|
||||
# Daily vaccuum script for PVC daemons
|
||||
# Ansible managed - last modified on 2019-08-12 13:20:15
|
||||
|
||||
# This script cleans up the PostgreSQL databases as well as the Zookeeper
|
||||
# database. This prevents filesystem growth balooning after loong running
|
||||
# periods.
|
||||
|
||||
#
|
||||
# PostgreSQL
|
||||
#
|
||||
|
||||
# Don't run if we aren't the Patroni primary
|
||||
HOSTNAME="$( hostname -s )"
|
||||
@ -11,7 +19,14 @@ if [[ $HOSTNAME != $PRIMARY ]]; then
|
||||
fi
|
||||
|
||||
# Analyze the database
|
||||
echo -e "----------------------------" &>>/var/log/pvc/pdns/vacuum.log
|
||||
echo -e "$( date )" &>>/var/log/pvc/pdns/vacuum.log
|
||||
echo -e "----------------------------" &>>/var/log/pvc/pdns/vacuum.log
|
||||
su postgres -c 'vacuumdb --verbose --analyze --all' &>>/var/log/pvc/pdns/vacuum.log
|
||||
echo -e "----------------------------" &>>/var/log/pvc/vacuum.log
|
||||
echo -e "$( date )" &>>/var/log/pvc/vacuum.log
|
||||
echo -e "----------------------------" &>>/var/log/pvc/vacuum.log
|
||||
su postgres -c 'vacuumdb --verbose --analyze --all' &>>/var/log/pvc/vacuum.log
|
||||
|
||||
#
|
||||
# Zookeeper
|
||||
#
|
||||
|
||||
export ZOOCFG=/etc/zookeeper/conf/zoo.cfg
|
||||
/usr/share/zookeeper/bin/zkCleanup.sh -n 7 &>>/var/log/pvc/vacuum.log
|
Reference in New Issue
Block a user