Data Analytics Studio Installation
Also available as:
PDF

Configure Postgres database

If you want to use and manage your own database instead of the default database provided, you must configure the Postgres database and create the required roles in the database.

  1. Install the supported version of postgres using the following commands:
    yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
    yum install postgresql96-contrib postgresql96-server

    For more information about the supported version of Postgres, see the DAS Support Matrix.

  2. Initialize the Postgres database by running the following command:
    service postgresql-9.6 initdb
  3. Open the Postgres configuration file pg_hba.conf for editing by entering the following command:
    vi /var/lib/pgsql/9.6/data/pg_hba.conf
  4. Configure Postgres to be accessible from Event Processor and DAS hosts. Add similar lines as follows to the configuration file:
    
    local   all             <dbuser>                              md5
    host    all             <dbuser>      0.0.0.0/0               md5
    host    all             <dbuser>      ::/0                    md5
    local   all             postgres         ident
    
  5. Edit the postgres configuration file postgresql.conf by opening and adding the following information:
    vi /var/lib/pgsql/9.6/data/postgresql.conf
    listen_addresses = '*'
  6. Start the Postgres database by running the following command:
    service postgresql-9.6 start
  7. Execute the following commands to create roles in Postgres:
    psql -tc "SELECT 1 FROM pg_database WHERE datname = <dbuser>" | grep 1 || (
    psql -c "CREATE ROLE <dbuser> WITH LOGIN PASSWORD <dbpass>;" &&
    psql -c "ALTER ROLE <dbuser> SUPERUSER;" &&
    psql -c "ALTER ROLE <dbuser> CREATEDB;" &&
    psql -c "CREATE DATABASE <dbuser>;" &&
    psql -c "GRANT ALL PRIVILEGES ON DATABASE <dbuser> TO <dbuser>;")
                        

    Replace <dbuser> with the database user name/database name and <dbpass> with database password.

    Note
    Note
    The database user and database name must be the same. It should be the one that is used as database username in the DAS configuration on Ambari.