Installing and configuring PostgreSQL

Learn how to install and configure PostgreSQL for Cloudera Edge Management (CEM).

For supported database versions, see System Requirements.

Install PostgreSQL

If you are using MySQL instead of PostgreSQL, you may skip these steps. See the instructions for MySQL in the previous section.
  1. Install Red Hat Package Manager (RPM) according to the requirements of your operating system:
    sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
  2. Install PostgreSQL version 9.6:
    yum install postgresql96-server postgresql96-contrib postgresql96
  3. Initialize the database:

    For example, if you are using CentOS 7, use the following syntax:

    /usr/pgsql-9.6/bin/postgresql96-setup initdb
  4. Start PostgreSQL.
    For example, if you are using CentOS 7, use the following syntax:
    systemctl enable postgresql-9.6.service
    systemctl start postgresql-9.6.service
  5. Verify that you can log in:
    sudo su postgres
    psql

Configure PostgreSQL to allow remote connections

It is critical that you configure PostgreSQL to allow remote connections before you deploy CEM. If you do not perform these steps in advance of installing the EFM Server, the installation fails.
  1. Open /var/lib/pgsql/9.6/data/pg_hba.conf and update to the following:
    # "local" is for Unix domain socket connections only
    local all all trust
    
    
    # IPv4 local connections:
    host all all 0.0.0.0/0 trust 
    
    
    # IPv6 local connections: 
    host all all ::/0 trust
  2. Open /var/lib//pgsql/9.6/data/postgresql.conf and update to the following:
    listen_addresses = '*'
  3. Restart PostgreSQL.
    systemctl stop postgresql-9.6.service
    systemctl start postgresql-9.6.service 

Configure PostgreSQL for use by EFM

  1. Log in to PostgreSQL:
    sudo su postgres
    psql
  2. Create a database for the EFM service to use:
    create database efm;
    CREATE USER efm WITH PASSWORD 'efmPassword';
    GRANT ALL PRIVILEGES ON DATABASE "efm" to efm;

Configure the EFM database properties

  1. Configure the database properties in the efm.properties file:
    efm.db.url=jdbc:postgresql://localhost:5432/efm
    efm.db.driverClass=org.postgresql.Driver
    efm.db.username=efm
    efm.db.password=efmPassword
    The URL should match the host and port of the machine running PostgreSQL. The password should match the value that you set using the following command:
    CREATE USER efm WITH PASSWORD 'efmPassword';