Configure External Database to Connect OpenG2P Environment
Last updated
Last updated
Copyright © 2024 OpenG2P. This work is licensed under Creative Commons Attribution International LicenseCC-BY-4.0 unless otherwise noted.
This document provides instructions to setup and install external database for OpenG2P environments.
Make sure you have the hardware required for the external database setup.
Log in to the external database node.
Install PostgreSQL using below commands.
After the installation of postgreSQL, use the below command to check the status.
Use the command below to log into the default postgres database using the default user, postgres, following a successful installation.
After you logged in, use the command below to confirm the database connection and details on the list of databases, users, and tables.
Command | Description |
---|---|
You should use the command below to set one for yourself, as the default postgres user does not have a password.
\password postgres
- to set the password, the password must have the combination of lowercase, uppercase, number. For example, xwfJhfI9tK
Note : The password must not have the special characters @, #, or -.
After setting up the postgres password, the user must exit from the database and run the command below to perform some server-level configurations.
Access the postgresql.conf file, locate the parameter below, uncomment it, set it to listen on all IP addresses, and configure it to increase the number of connections.
Acess pg_hba.conf file and allow TCP/IP connections (host) to all databases (all) for all users (all) with any IPv4 address (0.0.0.0/0) using an scram-sha-256 encrypted password for authentication and save the file.
Restart PostgreSQL service to load configuration changes.
Make sure your system is listening to the 5432 port that is reserved for PostgreSQL.
Use the command below to log back into postgresdb now. Provide the postgres database, the password that you have configured.
Use the command below to create the socialregistry and ODK databases, use a random password in each command.
Try onnecting to both the databases and verify.
Access the rancher-ui to start installing the SocialRegistry/PBMS and update the below parametes as shown below in the Edit YAML and install the services.
Make the default postgresql enabled equals to false.
Add the below parameters in the last section of postgresql.
Add the below parameters in the last section of ODK.
Add the below parameters in the last section of reportingInit.
Make sure the SR and ODK connected to the external databases and verify the tables by logging into the external database.
And for more information on high availability PostgreSQL clusters setup, refer here.
\conninfo
To check the connection
\l
List databases
\du
List users
\d
List tables (press q to exit)
\q
Exit from the database