Azure PostgreSQL

Azure PostgreSQL Database is a relational database service based on the open-source Postgres database engine. It is a fully-managed, enterprise-ready community PostgreSQL database as a service that can handle mission-critical workloads with predictable performance, security, high availability, and dynamic scalability.

You can ingest data from your Azure PostgreSQL database using Hevo Pipelines and replicate it to a Destination of your choice.

Prerequisites


Perform the following steps to configure your Azure PostgreSQL Source:

Create a Read Replica (Optional)

To use an existing read-replica or connect Hevo to your master database, skip to Set up Log-based Incremental Replication section.

To create a read-replica:

  1. Log in to the Azure Portal.

  2. Under Recent resources, select the database for which you want to create a read-replica.

    Select database

  3. Under Settings, click Replication, and then, click + Add Replica.

    Add replica

  4. In the Server name field, specify a unique name for the replica server and click OK.

    Specify replica name

A notification is displayed to confirm that the read-replica was created successfully.

Replica created notification


Set up Log-based Incremental Replication

Hevo supports data ingestion from PostgreSQL servers via Write Ahead Logs set at the logical level (available on PostgreSQL version 9.4). A Write Ahead Log(WAL) is a collection of log files that record information about data modifications and data object modifications made on a PostgreSQL server instance. Typically WAL is used for data replication and data recovery.

By default, replication method is set to REPLICA. You must change this to LOGICAL. To do this:

  1. Access the Microsoft Azure Portal.

    Azure login

  2. Under Settings, click Replication.

    Replication

  3. In the right pane, select replication support as LOGICAL.

  4. Click Save.

  5. Click YES in the confirmation dialog to restart the Postgres server for the parameter changes to take effect.

    server restart message

  6. Confirm under Notifications that your changes have been applied and server has restarted successfully before running the Pipeline, to avoid errors.


Whitelist Hevo’s IP Addresses

You need to whitelist the Hevo IP addresses for your region to enable Hevo to connect to your PostgreSQL database. You can do this by creating firewall rules in your Microsoft Azure database settings as follows:

  1. Access the Azure Portal.

  2. Under Resources, select the database you want to synchronize with Hevo.

  3. Under Settings, click Connection security.

  4. Create a Firewall Rule:

    1. Specify a firewall rule Name.

    2. Specify Hevo’s IP addresses in the Start IP and End IP fields as per your region.

      Note: As Hevo has specific IP addresses and not a range, the value in the Start IP and End IP fields is the same.

  5. Click Save.

  6. Repeat this step to add the IP address for each applicable Hevo region.


Create a Database User and Grant Privileges

1. Create a database user (optional)

To create a database user, open your Azure PostgreSQL database in your SQL client tool as a user with CREATE privilege and enter the following command:

CREATE ROLE hevo WITH LOGIN NOSUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION PASSWORD '<password>';

Note: Replace password above with a password of your choice.

2. Grant privileges to the user

The database user specified in the Hevo Pipeline must have the following privileges:

  • SELECT

  • USAGE

  • CONNECT

To assign this privileges:

  1. Log in to your Microsoft Azure PostgreSQL database as a user with admin privilege.

  2. Enter the following commands to give accesses to the database user:

     GRANT CONNECT ON DATABASE <database_name> to hevo;
     GRANT USAGE ON SCHEMA <schema_name> TO hevo;
    
  3. Alter the schema’s default privileges to grant SELECT privileges on tables to the database user

     ALTER DEFAULT PRIVILEGES IN SCHEMA <schema_name> GRANT SELECT ON TABLES to hevo;
     GRANT SELECT ON ALL TABLES IN SCHEMA <schema_name> TO hevo;
    

Retrieve the Hostname and Port Number (Optional)

Note: The Azure PostgreSQL hostnames start with your database name and end with azure.com.
For example:
Host : postgres.database.azure.com
Port : 5432

To retrieve the hostname:

  1. Log in to the Microsoft Azure Portal.

  2. Under Recent resources, select your Azure Database for PostgreSQL server.

    Select database

  3. In the Essentials panel, locate the Server name. Use this Server name as the hostname in Hevo while creating your Pipeline.

    Retrieve hostname

The default port value is 5432.


Limitations

  • Login using SSL not supported. This setting is enabled by default. You can disable it as follows:

    Disable SSL

    1. Under Settings, click Connection security.

    2. In SSL Settings on the right, set the toggle option for Enforce SSL connection to DISABLED.

    3. Click Save.

  • The data type Array in the Source is automatically mapped to Varchar at the Destination. No other mapping is currently supported.


Revision History

Refer to the following table for the list of key updates made to the page:

Date Release Description of Change
22-Feb-2021 1.57 Added sections:
- Create a Read Replica
- Create a User and Grant Privileges
- Retrieve the Hostname and Port Number.
Last updated on 29 Mar 2021