Run the following commands:
su - postgres /usr/pgsql-15/bin/postgresql-15-setup initdb /usr/pgsql-15/bin/pg_ctl -D /datakeeper/pgsql/data -l logfile start
Initialize Postgres Database Server on the Primary Node
In this instance, initdb is located at /usr/pgsql-15/bin/initdb. Use the location of initdb to construct the parameters here.
[root@node-a ~]# su postgres -c "/usr/pgsql-15/bin/initdb -D /datakeeper/pgsql/data" The files belonging to this database system will be owned by user "postgres". This user must also own the server process. (snip) Success. You can now start the database server using: /usr/pgsql-15/bin/pg_ctl -D /datakeeper/pgsql/data -l logfile start
Location of Postgres binaries | /usr/pgsql-15/bin/ |
Data | /datakeeper/pgsql/data |
Start the Postgres Process on the Primary Node
[root@node-a ~]# su postgres -c "/usr/pgsql-15/bin/pg_ctl start -D /datakeeper/pgsql/data" waiting for server to start....2020-12-30 03:40:20.925 UTC [6346] LOG: starting PostgreSQL 15 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit 2020-12-30 03:40:20.926 UTC [6346] LOG: listening on IPv6 address "::1", port 5432 2020-12-30 03:40:20.926 UTC [6346] LOG: listening on IPv4 address "127.0.0.1", port 5432 2020-12-30 03:40:20.932 UTC [6346] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2020-12-30 03:40:20.946 UTC [6346] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432" 2020-12-30 03:40:20.960 UTC [6346] LOG: redirecting log output to logging collector process 2020-12-30 03:40:20.960 UTC [6346] HINT: Future log output will appear in directory "log". done server started
Unix socket | /tmp/.s.PGSQL.5432 |
Protecting PostgreSQL Resource with LifeKeeper
- Click in the LifeKeeper user interface.
- The Create Resource Wizard at node-a will appear. Select PostgreSQL Database as the Recovery Kit.
- Select the following parameters.
Switchback Type | intelligent |
Server | node-a |
PostgreSQL Executable Location | /usr/pgsql-15/bin/ |
PostgreSQL Client Executable Location | /usr/pgsql-15/bin/psql |
PostgreSQL Administration Executable Location | /usr/pgsql-15/bin/pg_ctl |
PostgreSQL Data Directory | /datakeeper/pgsql/data |
PostgreSQL Port | 5432 |
PostgreSQL Socket Path | /tmp/.s.PGSQL.5432 |
Enter Database Administrator User | postgres |
PostgreSQL Logfile | /tmp/pgsql-5432.lk.log |
PostgreSQL Database Tag | pgsql-5432 |
The wizard checks these values. Once “pgsql-5432” is successfully created on node-a, continue to the next steps.
- Select the following values in the Pre-Extend Wizard @ node-a.
Target Server | node-b |
Switchback Type | intelligent |
Template Priority | 1 |
Target Priority | 10 |
The wizard checks these values. Once the Pre-Extend check is complete, continue to the next steps.
- Select the following values in the Extend database/pgsql Resource @ node-a wizard.
PostgreSQL Executable Location | /usr/pgsql-15/bin/ |
PostgreSQL Database Tag | pgsql-5432 |
Now the PostgreSQL resource is defined on LifeKeeper. The wizard automatically defines a dependency between the PostgreSQL resource and the replicated disk (/datakeeper).
Post your comment on this topic.