How to initialize Postgres Live GI
Prerequisites
This document assumes that Accelario server and agents on source and target servers already installed and configured, as well as Postgres binaries installed on source and target servers.
Installation
Go to SRC tab, choose the agent and click “Create Test Data Environment” button.
Choose PostgreSQL
Add name to you environment and click “Next” button
Review snapshot retention setting and choose according to your needs.
From drop down list choose your “Source Host”
You may also disable automatic snapshots
Click “Next” button
On the screen you will need to specify configuration for the Postgres instance which you are yet going to initialize (e.g this instance is not yet running, and you will need to use configs you entering when you initialize it)
User – should be user which will have superuser privileges (use postgres)
Password – this password will need to be set for the user upon database initialization
VDB password – This must be different from password you used, this password will be set for the user in the virtual database
Port – port which will be used for the LiveGI instance and set in postgresql.conf
Cluster Name – parameter cluster_name will need to be set in postgresql.conf
OS User – owner of postgres binaries
PostgreSQL Home Dir: directory where binaries of Postgres installed on the source/staging host
When everything is ready, click “Create” button.
Go to VDB section
Choose your Test Data Environment
Click “Create GI” button
Add description – Name for your GI
Click “Create” button
On created GI click information button
Take a note of the Storage Path
In this path, on the source host we will need to initialize our postgres instance
Go to Source host and find the path we noted from GI information.
We should create Golden Image database in this location. In our case this location is: /main_pool/00000038 as shown in “Storage Path”
Under this location we should manually create the following structure folders: <Storage Path>/<PG_MAIN_VERSION>/<CLUSTER_NAME>
After creating the directories under /main_pool/00000038
don’t forget provide them with 750 permission and ownership for postgres OS user.
e.g.
In the Step 5, we assigned a value to Cluster Name = pg14
The main Postgres version in the example is 14
mkdir -p /main_pool/00000038/14/pg14
chown -R postgres:postgres /main_pool/00000038/14
chmod -R 750 /main_pool/00000038/14
Initialize Postgres Instance with PG_DATA directory pointing to :
<Storage Path>/<PG_MAIN_VERSION>/<CLUSTER_NAME>
The path we create in Step 9:
/main_pool/00000038/14/pg14
Run:
pg_ctl -D /main_pool/00000038/14/pg14 initdb
Above command will create an empty postgres database in the specified location.
Now we need to edit postgresql.conf
and then start the instance
In our example, the files are created under /main_pool/00000038/14/pg14
Edit postgresql.conf
and set the following basic parameters:
cluster_name = 'pg14' - or any other value you choose for cluster name
listen_addresses = ‘*'
port = 5433
wal_keep_size= ‘300’ – This is for deletion WALs automatically and saving max 300MB of WAL files.
Handle Archiving
Create directory to store archived logs:
mkdir /main_pool/00000038/14/pg14/archives
archive_mode = on # enables archiving; off, on, or always
# (change requires restart)
archive_command = 'test ! -f /main_pool/00000010/14/pg14/archives/%f && cp %p /main_pool/00000010/14/pg14/archives/%f' # command to use to archive a logfile segment
Important Note:
All files of postgres instance must reside on the path we use!
No soft links are allowed!
When you finished editing postgresql.conf
file you can start the instance
Now, login to the instance and change the user password you specified in Step 5
Connect to the instance with psql:
Change the password :
Now you can go and activate the LiveGI
Upon successful activation you should see the first snapshot created
Create first VDB from your snapshot
Click create VDB button on the snapshot
Enter parameters:
Name: Logical Name for you VDB
Start immediately: check this option
Target DB Home: Choose configured target agent from drop-down list
Cluster Name: Choose any cluster name: In the example we use “pg14”
DB Port: port which will be assigned to Postgres instance on target host
Click “Create VDB” button
Upon completion you should see the VDB is created and has a green sign on it indicating successful VDB creation
Now you can connect to the instance on the target server.
The password for user is the password we set in Step 5 for VDB password