0% found this document useful (0 votes)
17 views

Backing Up Databases

This document provides instructions for backing up PostgreSQL, MariaDB, and MySQL databases. For PostgreSQL, the pg_dump command is used to backup databases by specifying the hostname, port, username, and password. For MariaDB and MySQL, the mysqldump command is used similarly. Examples are given for backing up Cloudera software databases. Finally, links to database vendor documentation on backups are also provided.

Uploaded by

Shoeb Ahmed Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Backing Up Databases

This document provides instructions for backing up PostgreSQL, MariaDB, and MySQL databases. For PostgreSQL, the pg_dump command is used to backup databases by specifying the hostname, port, username, and password. For MariaDB and MySQL, the mysqldump command is used similarly. Examples are given for backing up Cloudera software databases. Finally, links to database vendor documentation on backups are also provided.

Uploaded by

Shoeb Ahmed Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

https://www.linkedin.com/in/syedashrafcloud/ YouTube: https://youtu.

be/__SBjmHEBfY

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 :

3. com.cloudera.cmf.db.name=scm

4. com.cloudera.cmf.db.user=scm

com.cloudera.cmf.db.password=NnYfWIjlbk

5. 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)

6. Enter the password from the com.cloudera.cmf.db.password property in step 2.

Web site: https://cloudstable.blogspot.com/


https://www.linkedin.com/in/syedashrafcloud/ YouTube: https://youtu.be/__SBjmHEBfY

7. To back up a database created for one of the roles described in Creating Databases

for Cloudera Software, on the local host as the roleuser user:

# pg_dump -h hostname -p 7432 -U roleuser > /tmp/roledb

8. 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

Web site: https://cloudstable.blogspot.com/


https://www.linkedin.com/in/syedashrafcloud/ YouTube: https://youtu.be/__SBjmHEBfY

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 :


Web site: https://cloudstable.blogspot.com/
https://www.linkedin.com/in/syedashrafcloud/ YouTube: https://youtu.be/__SBjmHEBfY

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

Web site: https://cloudstable.blogspot.com/


https://www.linkedin.com/in/syedashrafcloud/ YouTube: https://youtu.be/__SBjmHEBfY

Database Vendor Resources


Use the following links to access vendor documentation on backing up and restoring

databases.

➢ MariaDB 5.5: http://mariadb.com/kb/en/mariadb/backup-and-restore-overview/

➢ MySQL 5.5: http://dev.mysql.com/doc/refman/5.5/en/backup-and-recovery.html

➢ MySQL 5.6: http://dev.mysql.com/doc/refman/5.6/en/backup-and-recovery.html

➢ PostgreSQL 8.4: https://www.postgresql.org/docs/8.4/static/backup.html

➢ PostgreSQL 9.2: https://www.postgresql.org/docs/9.2/static/backup.html

➢ PostgreSQL 9.3: https://www.postgresql.org/docs/9.3/static/backup.html

➢ Oracle 11gR2: http://docs.oracle.com/cd/E11882_01/backup.112/e10642/toc.html

Web site: https://cloudstable.blogspot.com/

You might also like