9.3.2

Table Of Contents
2 To create a replication user, run the
script /opt/vmware/vpostgres/current/scripts/create_replication_user replica_username.
This example creates the replica user replicate.
/opt/vmware/vpostgres/current/scripts/create_replication_user replicate
What to do next
You can now create a replica server using the replication user account. See “Create a Replica Server,” on
page 33.
Create a Replica Server
You can transform an existing vFabric Postgres server into a replica (or slave) by synchronizing it with a
given root node (either slave or master), or reconnecting to an existing node in the cluster.
The run_as_replica script lets you create a replica of an existing root node from a read-only slave. This
allows you to leverage read activity of an application with load balancing through multiple virtual machines
running vFabric Postgres.
The script automatically registers the SSH authorization key of a slave node on a root node for archive
transfer between nodes, so you do not need to provide additional settings for pg_hba.conf, recovery.conf,
postgresql.conf or SSH on the root node. Note that as the max_wal_senders default value is set to 3, you may
need to increase this value on the root node when connecting with more than one slave to a given root node.
You can also use this script to reconnect an existing slave to a new root node. In cases where the slave node
is not able to catch up with the root node because of missing WAL archive files, or the slave node was in
advance compared to the root node in regards to WAL replay, you must create a new base backup.
Prerequisites
Create a replication user account with which to create and promote replica server nodes. See “Create a
Replication User Account,” on page 32.
Procedure
1 Log in as the replication user.
2 To create a replica server, run the script /opt/vmware/vpostgres/current/scripts/run_as_replica.
/opt/vmware/vpostgres/current/scripts/run_as_replica -h IP_MASTER -b -W -U replication
Option Description
-h
Specifies the IP address of the master server.
-b
Creates a new base backup. When creating a new slave on a newly
installed vFabric Postgres database, use option -b to create a new base
backup.
-W
Specifies that the operating system prompt you to enter the password of
the user you specify using the -U option.
-U
Specifies the user with which to connect to the remote node. The
replication user is recommended.
What to do next
Once you create a replica server, you can promote it to be a primary database. See “Promote a Replica
Database to Primary Database,” on page 34.
Chapter 4 Managing vFabric Postgres
VMware, Inc. 33