Test failover functionality from the primary appliance database machine to the secondary machine.
About this task
For this test, the appliance database is failed over, and the replica database on the secondary appliance becomes the master database.
The appliance database is installed and configured on primary and secondary vRealize Appliances as described in vRealize Automation Installation and Configuration.
- Log in to your primary, or master, appliance as root using SSH.
- Stop the vpostgres service using the
service vpostgres stopcommand.
A message similar to the following appears.
# service vpostgres stop Stopping VMware vPostgres: Last login: Mon Apr 27 19:49:26 UTC 2015 on pts/0 ok
- Log in to the secondary appliance as root using SSH.
- Run the
/opt/vmware/vpostgres/current/share/promote_replica_to_primarycommand as the postgres user to promote the replica database to master.
su - postgres /opt/vmware/vpostgres/current/share/promote_replica_to_primary server promotingNote:
After running this command, the replica database on the secondary appliance becomes the master. The appliance database on the original primary appliance does not become an actual replica until you run the
- Log in to the targeted replica appliance machine as root using SSH.
- Configure replication using the following command.
./run_as_replica -h master database appliance -b -W -U replicate
Replace the parameters with the following values.
Host name of the master database server. Port 5432 is assumed.
Take a base backup from the master. This option destroys the current contents of the data directory.
Prompt for the password of the user performing the replication.
The user performing the replication. Generally this user is replicate.
# su - postgres /opt/vmware/vpostgres/current/share/run_as_replica -h app2.domain.local -b -W -U replicate
- Enter the replicate user password when prompted.
- Type "yes" after verifying the thumb print of the primary machine when prompted.
- Enter the postgres user password when prompted.
- Type "yes" in response to the following message.
"WARNING: the base backup operation will replace the current contents of the data directory. Please confirm by typing yes."
What to do next
Validate that the replication was successful. See Validate Appliance Database Replication.