Configuring a Ranger Database: PostgreSQL

Prior to upgrading your cluster to CDP Private Cloud Base you must configure the PostgreSQL database instance for Ranger by creating a Ranger database and user. Before you begin the transition, review the support policies of database and admin policy support for transactions.

A supported version of PostgreSQL must be running and available to be used by Ranger. See Install and Configure PostgreSQL for CDP.

  1. Log in to the host where you want to set up the PostgreSQL database for Ranger.
  2. On the PostgreSQL host, install the applicable PostgreSQL connector:
    RHEL/CentOS/Oracle Linux
    yum install postgresql-jdbc*

    SLES

    zypper install -y postgresql-jdbc
  3. Edit the pg_hba.conf file, located either in the /var/lib/pgsql/data or /etc/postgresql/<version>/main directory and add the following line:
    host all all 127.0.0.1/32 md5

    If this file contains the line host all all 127.0.0.1/32 ident, then

  4. Edit the /var/lib/pgsql/data/postgresql.conf file and add the following line if it is not already there:
    listen_addresses='*'
  5. Enable the PostgreSQL server to start automatically on boot-up:
    sudo systemctl enable postgresql
  6. Restart the PostgreSQL server:
    sudo systemctl restart postgresql
  7. Log in to PostgreSQL:
    sudo -u postgres psql postgres
  8. Create the Ranger database and user. Run the following commands:
    create user rangeradmin with createdb login password 'rangeradmin';
    create database ranger with owner rangeradmin;
    GRANT ALL PRIVILEGES ON SCHEMA public TO rangeradmin;
    GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO rangeradmin;
    GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO rangeradmin;
    
  9. Use the \q command to exit PostgresSQL.
Continue installing or upgrading your cluster.