Backup Ranger Admin Database

You must run the below commands on the Ranger database host.

MySQL

  1. First create directory (mkdir -p /root/backups/ranger/db/admin)
    $ mysqldump -u [username] -p db_name > dump_fileName.sql   
    or specify destination as
    /some_dir/dump_fileName.sql 
  2. Select the Enter key.
  3. Type the database password at the password prompt.

Example

mysqldump -u rangeradmin -p ranger > /root/backups/ranger/db/admin/ranger.sql

POSTGRES

  1. Dump the contents of a database to a file by running the following command. Replace database name with the name of the database to be backed up:

    pg_dump -U username dbname > dbname.bak

    Example

    pg_dump -U rangeradmin ranger > /root/backups/ranger/db/admin/db/ranger.sql
  2. Type the database password at the password prompt.