rhevm
Postgres Databaserhevm
database is a key component of the Red Hat Enterprise Virtualization environment so it is highly recommended that regular backups of the database be taken.
rhevm
database, they should be repeated for each database being backed up. For example, the same procedures can be used to back up and restore the rhevm_history
database.
rhevm
database:pg_dump
command to dump the rhevm
database:
# pg_dump -C -E UTF8 --column-inserts --disable-dollar-quoting --disable-triggers -U postgres --format=p -f /usr/share/rhevm/db-backups/dump_RHEVDB_BACKUP_`date "+%Y%m%d_%R"`.sql
rhevm
/usr/share/rhevm/db-backups/dump_RHEVDB_BACKUP_`date "+%Y%m%d_%R"`.sql
should be replaced with a desired location and file name.
pg_dump
to write the database backup file directly to the mounted remote location.
.sql
file to a remote backup location. This can be accomplished using scp, rsync, or some other third party back up tool.
rhevm
database backup with ssh keys, a script, and a cron job.
rhevm
Postgres database backup script~/.ssh/authorized_hosts
using the ssh-copy-id BACKUPUSER@BACKUPDIRECTORY
command so that the scp
command can be done without a password.
#!/bin/sh # Enter appropriate values for the BACKUPUSER, BACKUPSERVER, and BACKUPDIRECTORY variables. DATE = `date "+%Y%m%d_%R"`; BACKUPUSER = ; BACKUPSERVER = ; BACKUPDIRECTORY = ; # pg_dump -C -E UTF8 --column-inserts --disable-dollar-quoting --disable-triggers -U postgres --format=p -f/usr/share/rhevm/db-backups/dump_RHEVDB_BACKUP_`date "+%Y%m%d_%R"`.sql
rhevm; scp/usr/share/rhevm/db-backups/dump_RHEVDB_BACKUP_`date "+%Y%m%d_%R"`.sql
$BACKUPUSER@$BACKUPSERVER:$BACKUPDIRECTORY;
rhevm
database using the pg_dump
, you can use the .sql
file you created to restore the rhevm
database.
rhevm
database:.sql
that was created using the pg_dump
command, use the psql
interactive shell. From the terminal on the Red Hat Enterprise Virtualization Manager server as root:
# psql -U postgres -d rhevm -W /usr/share/rhevm/db-backups/dump_RHEVDB_BACKUP_`date "+%Y%m%d_%R"`.sql
Substitute the name of the .sql
file being restored for dump_RHEVDB_BACKUP_CURRENT_DATE
.
rhevm
database to create a new one, first stop the jbossas service using the service jbossas stop
command.
rhevm
database and imported database backup file, start the jbossas service using the service jbossas start
.