This chapter presents the available scripts. All our scripts have a detailed synopsis please, check the option “-h” or “—help”.
Operating system Start/Stop integration
DMK provides a tiny script which integrated to the boot procedure serves to start & stop all the PostgreSQL services smoothly for either SYSV or systemd based Linux dsitributions:
This script is parsing the PostgreSQL log file and alerts whenever an issue is found:
$DMK_HOME/bin/dmk-check-pg-logfile.sh --help
USAGE of dmk-check-pg-logfile.sh -s [-m]
SYNOPSIS
dmk-check-pg-logfile.sh
-h print this help message
-s the PostgreSQL pgtab alias
-m Send an email in case of any issues detected
DESCRIPTION
This script is used to check the PostgreSQL log file for FATAL and ERROR messages
This script is used to perform basic health check against a PostgreSQL instance and is ending alerts in case of any issues:
$DMK_HOME/bin/dmk-check-postgres.sh --help
USAGE of dmk-check-postgres.sh -s [-m]
SYNOPSIS
dmk-check-postgres.sh
-v print version of this script
-h print this help message
-s the PostgreSQL pgtab alias
-m Send an email in case of any issues detected
DESCRIPTION
This script is used to perform various healthchecks against a PostgreSQL instance
This script is a wrapper around pgBadger and periodically generates pgBadger reports:
$DMK_HOME/bin/dmk-pg-badger-reports.sh --help
USAGE of dmk-pg-badger-reports.sh -s [-f -d -r -c -t -m -e]
SYNOPSIS
dmk-pg-badger-reports.sh
-v print version of this script
-h print this help message
-s the PostgreSQL pgtab alias
DESCRIPTION
This script is used to generate pgbader reports out of the PostgreSQL instance logfiles
DEFAULTS
We assume that the PostgreSQL logfile is rotated each day
In case BARMAN is used to create PostgreSQL backups this script is a wrapper for automating backups with BARMAN:
$DMK_HOME/bin/dmk-pg-barman-backup.sh --help
USAGE of dmk-pg-barman-backup.sh -s [-m]
SYNOPSIS
dmk-pg-barman-backup.sh
-v print version of this script
-h print this help message
-s the PostgreSQL pgtab alias
-m send mail notification not only on failure but also on success
DESCRIPTION
This script is a wrapper around barman which does the backup with barman either manually or scheduled via cron
This script is used to automatically create PostgreSQL instances:
$DMK_HOME/bin/dmk-pg-dbcreate.pl --help
USAGE of dmk-pg-dbcreate.pl
SYNOPSIS
dmk-pg-dbcreate.pl -f <configuration_file>
DESCRIPTION
Initializes a PostgreSQL database cluster based on the configuration file
There is a template configuration file in $DMK_HOME/templates/postgres/create_database.cfg
DEPENDENCIES
Basic DMK environment must be installed previously
For the creation of the systemd service sudo must be setup for the postgres user.
LIMITATIONS
n.a
PARAMETERS
-h|help Display help
-v|version Display version
-f|file Path to the configuration file
DISCLAIMER
n.a.
This script helps with doing logical dumps of PostgreSQL instances:
$DMK_HOME/bin/dmk-pg-dump.sh --help
USAGE of dmk-pg-dump.sh -s [-f -d -r -c -t -m -e -l]
SYNOPSIS
dmk-pg-dump.sh
-v print version of this script
-h print this help message
-s the PostgreSQL pgtab alias
-f shall we do a full dump ? (pg_dumpall)
-d the database which shall be dumped, if not a full dump
-r the retention in days to keep the dumps
-c compress the dump (ignored for full dumps)
-t the target directory for the dumps
-m send mail notification not only on failure but also on success
-e send an email which lists all dumps that have been deleted according to the retention policy
-l the host the database instance is running on when not localhost this is used for dumping over the network
-u the user to be used for connecting to the database. The default is postgres.
we do not accept a password so it must be either in .pgpass or the environment
DESCRIPTION
This script is used to either dump a single database from a PostgreSQL instance or to do a full dump of the whole PostgreSQL cluster. For a
database dump
we use standard pg_dump and for a full dump we use standard
pg_dumpall.
DEFAULTS
- The default is to do a full dump, this means if you do not provide
a database
name to dump a full dump will be done
- The default target directory is: /u90/pgdata/[PGALIAS]/dumps/
You can overwrite this by using the -t switch
- The default retention to keep the dumps is 7 days
You can overwrite this by using the -r switch
dmk-pgpool-*.sh
The dmk-pgpool scripts provide integration with pgpgool when it comes to automated failover and can be used as templates for custom setups.