Backing up databases

Cloudera recommends that you schedule regular backups of the databases that Cloudera Manager uses to store configuration, monitoring, and reporting data and for managed services that require a database:

Backing Up PostgreSQL Databases

To back up a PostgreSQL database, use the same procedure whether the database is embedded or external:
  1. Log in to the host where the Cloudera Manager Server is installed.
  2. Get the name, user, and password properties for the Cloudera Manager database from /etc/cloudera-scm-server/db.properties:
    com.cloudera.cmf.db.name=scm
    com.cloudera.cmf.db.user=scm
    com.cloudera.cmf.db.password=NnYfWIjlbk
  3. Run the following command as root using the parameters from the preceding step:
    # pg_dump -h hostname -p 7432 -U scm > /tmp/scm_server_db_backup.$(date +%Y%m%d)
  4. Enter the password from the com.cloudera.cmf.db.password property in step 2.
  5. To back up a database created for one of the roles on the local host as the roleuser user:
    # pg_dump -h hostname -p 7432 -U roleuser > /tmp/roledb
  6. Enter the password specified when the database was created.

Backing Up MariaDB Databases

To back up the MariaDB database, run the mysqldump command on the MariaDB host, as follows:

mysqldump -hhostname -uusername -ppassword database > /tmp/database-backup.sql
For example, to back up the Activity Monitor database amon created in Creating Databases for Cloudera Software, on the local host as the root user, with the password amon_password:
mysqldump -pamon_password amon > /tmp/amon-backup.sql
To back up the sample Activity Monitor database amon on remote host myhost.example.com as the root user, with the password amon_password:
mysqldump -hmyhost.example.com -uroot -pamon_password amon > /tmp/amon-backup.sql

Backing Up MySQL Databases

To back up the MySQL database, run the mysqldump command on the MySQL host, as follows:m
mysqldump -hhostname -uusername -ppassword database > /tmp/database-backup.sql
For example, to back up the Activity Monitor database amon created in Creating Databases for Cloudera Software, on the local host as the root user, with the password amon_password:
mysqldump -pamon_password amon > /tmp/amon-backup.sql
To back up the sample Activity Monitor database amon on remote host myhost.example.com as the root user, with the password amon_password:
mysqldump -hmyhost.example.com -uroot -pamon_password amon > /tmp/amon-backup.sql
You can back up all database using the following command:
mysqldump --all-databases -ppassword > /tmp/all1/all.sql

Backing Up Oracle Databases

For Oracle, work with your database administrator to ensure databases are properly backed up.