How to collect a RHEV 3.x and RHV 4 database dump
Environment
- Red Hat Enterprise Virtualization (RHEV) 3.x
- Red Hat Virtualization (RHV) 4.x
Issue
- Red Hat Support asked me to provide RHEV database dump for troubleshooting. How do I collect this db dump?
Resolution
The best and recommended way to collect a RHV database dump is to use the rhevm-log-collector/engine-log-collector/ovirt-log-collector tool. If only the database is needed, the file size is reduced by using --no-hypervisors which skips collecting logs from the hosts. It is important to provide the password for the PostgreSQL user, if asked:
-
For 3.n
# rhevm-log-collector collect --no-hypervisors Please provide the REST API password for the admin@internal RHEV-M user (CTRL+D to skip): ... Please provide the password for the PostgreSQL user, postgres, to dump the rhevm PostgreSQL database instance (CTRL+D to skip): -
For 4.n
# ovirt-log-collector collect --no-hypervisors Please provide the REST API password for the admin@internal RHEV-M user (CTRL+D to skip): ... Please provide the password for the PostgreSQL user, postgres, to dump the rhevm PostgreSQL database instance (CTRL+D to skip):
Click here for more information about the Log Collector tool.
If, for any reason, the full log collector is unavailable or it fails to collect the db dump, the following command can be run manually to collect the db from the RHV-M's command line interface:
-
For 3.0:
# pg_dump rhevm -U postgres -w -f /tmp/rhevmdb-$(date +%Y-%m-%d-%H%M%S).dump -F t -
For 3.1, 3.2:
# export PGPASSFILE=/etc/ovirt-engine/.pgpass # pg_dump engine -U postgres -w -f /tmp/enginedb-$(date +%Y-%m-%d-%H%M%S).dump -F t -
For 3.3 until 4.1:
# source /etc/ovirt-engine/engine.conf.d/10-setup-database.conf # PGPASSWORD=$ENGINE_DB_PASSWORD pg_dump -h $ENGINE_DB_HOST -U $ENGINE_DB_USER -w -f /tmp/enginedb-$(date +%Y-%m-%d-%H%M%S).dump -F t $ENGINE_DB_DATABASE -
For RHV 4.2:
# source /etc/ovirt-engine/engine.conf.d/10-setup-database.conf # PGPASSWORD="$ENGINE_DB_PASSWORD" scl enable rh-postgresql95 -- pg_dump -h $ENGINE_DB_HOST -U $ENGINE_DB_USER -w -f /tmp/engine.db-$(date +%Y-%m-%d-%H%M%S).dump -F t $ENGINE_DB_DATABASE -
For RHV 4.3:
# source /etc/ovirt-engine/engine.conf.d/10-setup-database.conf # PGPASSWORD="$ENGINE_DB_PASSWORD" scl enable rh-postgresql10 -- pg_dump -h $ENGINE_DB_HOST -U $ENGINE_DB_USER -w -f /tmp/engine.db-$(date +%Y-%m-%d-%H%M%S).dump -F t $ENGINE_DB_DATABASE -
For RHV 4.4:
# source /etc/ovirt-engine/engine.conf.d/10-setup-database.conf # PGPASSWORD=$ENGINE_DB_PASSWORD pg_dump -h $ENGINE_DB_HOST -U $ENGINE_DB_USER -w -f /tmp/enginedb-$(date +%Y-%m-%d-%H%M%S).dump -F t $ENGINE_DB_DATABASE
Note: The -w option can be removed to provide password to the db manually instead of using the .pgpass saved password file.
Attach the created dump file to the support case.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.