Back up OpenNMS Horizon
This section describes a basic backup process for a default OpenNMS Horizon installation. OpenNMS Horizon binaries, logs, RRD archives, configurations, and the database are backed up during this process.
The backup storage path in this example is /tmp for demonstration purposes.
Please be aware that /tmp is not persisted, as most operating systems will delete the content at bootup.
|
Objectives
-
Create a backup of OpenNMS Horizon components.
-
Create a PostgreSQL database backup.
-
Run a restore without having OpenNMS installation packages available.
Requirements
-
A system user with administrative permissions (sudo).
-
Database password for
opennms
andpostgres
user.
Create backup
Stop OpenNMS Horizon service
sudo systemctl stop opennms
Back up OpenNMS Horizon binaries, RRD archives, configurations
sudo tar --exclude='/opt/opennms/data/cache' -cvzf /tmp/opennms-opt.tar.gz /opt/opennms && \
sudo tar -cvzf /tmp/opennms-var.tar.gz /var/opennms
Create PostgreSQL database backup
sudo runuser -l postgres -c 'pg_dumpall -f /tmp/opennms-postgres.dmp'
Back up OpenNMS Horizon operating system user
sudo grep opennms /etc/passwd > /tmp/opennms-passwd.txt && \
sudo grep opennms /etc/group > /tmp/opennms-group.txt
Stop OpenNMS Horizon service
sudo systemctl stop opennms
Back up OpenNMS Horizon binaries, RRD archives, configurations
sudo tar --exclude='/usr/share/opennms/data/cache' -cvzf /tmp/opennms-usr-share.tar.gz /usr/share/opennms && \
sudo tar -cvzf /tmp/opennms-etc.tar.gz /etc/opennms && \
sudo tar -cvzf /tmp/opennms-var-lib.tar.gz /var/lib/opennms && \
sudo tar -cvzf /tmp/opennms-usr-share-java.tar.gz /usr/share/java/opennms
Create PostgreSQL database backup
sudo runuser -l postgres -c 'pg_dumpall -f /tmp/opennms-postgres.dmp'
Back up OpenNMS Horizon operating system user
sudo grep opennms /etc/passwd > /tmp/opennms-passwd.txt && \
sudo grep opennms /etc/group > /tmp/opennms-group.txt