PostgreSQL SSL Integration Guide
Review the following guide for setting up an integration between Litmus Edge and a PostgreSQL database using SSL authentication.
You will need the following:
- Access to a PostgreSQL database that uses SSL authentication.
- The CA Certificate and any other required authentication parameters to access the database.
Refer to the following links to learn more:
Follow the steps to Add a Connector and select the DB - PostgreSQL SSL provider.
Configure the following parameters.
- Name: Enter a name for the connector.
- Hostname: Enter the hostname for the PostgreSQL database.
- Port: The PostgreSQL Server port. The default value is 5432.
- SSL Mode: Select the SSL Mode (require, verify-ca, verify-full).
- CA Certificate: Paste or upload the CA certificate associated with the database.
- Certificate: Paste or upload the SSL certificate.
- Private Key: Enter or paste the SSL private key.
- Username: Enter the appropriate username.
- Password: Enter the password for the username.
- Database: Enter the database name.
- Table: Enter the table name.
- Show Mapping: If you want to send data to a custom table, select this check box and unselect Create table. See Work with Tables in SQL Connectors (Create Table and Show Mapping) to learn more. To add key/value pairs for the custom table, see Configure Key/Value Pairs.
- Create table: If you want to send data to an existing table in the default format, or you want to create a new table in the default format, select this checkbox and unselect Show Mapping. See Work with Tables in SQL Connectors (Create Table and Show Mapping) to learn more.
- Commit timeout: Enter the transaction commit timeout in (ms).
- Max transaction size: Enter the maximum number of messages before a transaction is committed, regardless of timeout parameter.
- Bulk insert count: To enable this option, enter the number of messages to group together and send as one bulk insert statement. Enabling this option can improve how quickly data is processed when dealing with high volumes of tags.
- Throttling limit: The maximum number of messages per second to be processed. The default value is zero, which means that there is no limit.
- Persistent storage: When enabled, this will cause messages to undergo a store-and-forward procedure. Messages will be stored within Litmus Edge when cloud providers are online.
- Queue Mode: Select the queue mode as lifo (last in first out) or fifo (first in first out). Selecting lifo means that the last data entry is processed first, and selecting fifo means the first data entry is processed first.
After adding the connector, click the toggle in the connector tile to enable it.
If you see a Failed status, you can review the Connector Logs and relevant error messages.
You will now need to import the tags created in Step 2 as topics for the PostgreSQL connector. The topics will be created as outbound topics.
After adding all required topics, navigate to the Integration overview page and ensure the connector is not disabled and still shows a CONNECTED status.
You can now verify that you can view data in the PostgreSQL database.
Update the credentials, database name, and table name to your specific configurations.
To make PostgreSQL queries:
- From the PostgreSQL terminal window, enter psql -h locahost -U postgres and press ENTER. If you configured a different username, replace postgres. The psql (9.6.5) version number appears.
- Enter \l and press ENTER. The list of databases appears in the console.
- Enter \c postgres and press ENTER. You are now connected to database "db-example" as user "postgres" appears.
- Enter \dt and press ENTER. The list of relations appears showing the devicehub schema.
- Enter \d devicehub and press ENTER. The public.devicehub table appears.
- Enter select * from devicehub; and press ENTER. The data for the devicehub table appears.