Setting up PostgreSQL database for SSB

After installing PostgreSQL server, you must rename the JDBC connector, and create a database with credentials for SQL Stream Builder (SSB) before installing the service on your cluster. You also must install the PostgreSQL Python connector to integrate with the Streaming SQL Console.

Before you begin

You need to install and configure PostgreSQL, before setting up the databases for SSB. To install and configure PostgreSQL, you must complete the basic steps mentioned in the Private Cloud Base documentation.

Installing the PostgreSQL JDBC connector

  1. Download the PostgreSQL JDBC Driver from the PostgreSQL website.
  2. Rename the JDBC jar file to postgresql-connector-java.jar.
    mv postgresql-jdbc.jar postgresql-connector-java.jar
  3. Copy the PostgreSQL JDBC jar file to your host.
    This host must be the same host where you plan to assign the Streaming SQL Console service role. The service roles are assigned as a next step when installing SQL Stream Builder as a service in Cloudera Manager.
    scp <location>/postgresql-connector-java.jar root@<your_hostname>:
    You will be prompted to provide your password.
  4. Access the host on your cluster.
    This host must be the same host where you have added the JDBC jar file.
    ssh root@<your_hostname>
    You will be prompted to provide your password.
  5. Copy the PostgreSQL JDBC jar file to /usr/share/java folder using the following command:
    sudo mkdir -p /usr/share/java
    sudo cp <location>/postgresql-connector-java.jar /usr/share/java
  6. Check if the PostgreSQL connector is in the folder with ls command.

Creating PostgreSQL database for SSB

  1. Access a host on your cluster.
    This host must be the same host where you plan to assign the Materialized Views Engine and Streaming SQL Console service role. The service roles are assigned as a next step when installing SQL Stream Builder as a service in Cloudera Manager.
    ssh root@<your_hostname>
    You will be prompted to provide your password.
  2. Connect to PostgreSQL:
    sudo -u postgres psql
  3. Create a database for the SQL Stream Builder metadata:
    CREATE ROLE ssb_admin LOGIN PASSWORD '<password>';
    CREATE DATABASE ssb_admin OWNER ssb_admin ENCODING 'UTF8';
    
  4. Create a database for the Materialized View Engine:
    CREATE ROLE ssb_mve LOGIN PASSWORD '<password>';
    CREATE DATABASE ssb_mve OWNER ssb_mve ENCODING 'UTF8';
  5. Confirm that you have created the Streaming SQL Console and Materialized View Engine database using the \l command.