Failover Clustering
Failover clustering provides for multiple physical servers (nodes) to access a common, shared storage subsystem that contains one or more file shares or volumes. The failover services ensure that only one server controls the file shares or volumes at a time. Control of the shared storage subsystem is passed automatically from a failed server to the next active server in the cluster.
The PSQL engine must be licensed separately on each cluster node where you install it, whether the node is a physical or a virtual machine. See also License Models in PSQL User's Guide. The failover clustering being discussed refers to Microsoft Failover Clustering or Cluster Service and to Linux Heartbeat. This is distinct from other high availability solutions that may incorporate VM-based clusters.
This section contain the following topics:
Microsoft Failover Clustering for Windows Server
This topic discusses adding the PSQL services to Failover Clustering and assumes the following:
Preliminary Requirements
You must assure that failover clustering functions correctly before you add PSQL services. For example, verify that the failover completes and that all resources are available. Complete the action again and fail over back to the original node. See the Microsoft documentation for how to set up Failover Clustering, verify that it is working correctly, and perform tasks through its interface.
Recommended Installation Process
The following table explains the recommended process to add PSQL to Cluster Services on Windows Server.
Do not install PSQL on the cluster shared storage where the PSQL data resides.
Note: Because of the dependencies, bring the PSQL resources online in the following order: first the PSQL Transactional Engine then the PSQL Relational Engine (and stop them in reverse order).
In PCC, set the following engine properties for Directories. When PCC prompts you to restart the services, select No.
For Transaction Log Directory, specify the location on the shared disk where you copied the Transaction Logs directory.
For DBNames Configuration Location, specify the location on the shared disk where you copied the DBNAMES.CFG file.
In the DEFAULTDB properties under Directories, set Dictionary Location to the location on the shared disk where you copied the DEFAULTDB directory. Under Data Directories, replace the default entry with this same location.
In the DEMODATA properties under Directories, set Dictionary Location to the location on the shared disk where you copied the DEMODATA directory. Under Data Directories, replace the default entry with this same location.
In the TEMPDB properties under Directories, set Dictionary Location to the location on the shared disk where you copied the TEMPDB directory. Under Data Directories, replace the default entry with this same location.
Your PSQL failover cluster is now configured.
*Note: If you need to apply a patch to PSQL v12 servers in a cluster environment, see the Actian Technical Support knowledge base article on this topic.
Linux Heartbeat
The Heartbeat program is one of the core components of the Linux-HA (High-Availability Linux) project. Heartbeat runs on all Linux platforms and performs death-of-node detection, communications and cluster management in one process.
This topic discusses adding the PSQL services to Linux Heartbeat and assumes the following:
Preliminary Requirements
It is essential that Linux Heartbeat be functioning correctly before you add PSQL to the cluster. See the documentation from the High Availability Linux Project (www.linux-ha.org) for how to install Heartbeat, verify that it is working correctly, and perform tasks with it.
Just as you would for any application, set up the essential clustering components before you add PSQL.
Recommended Installation Process
The following table explains the recommended process to add PSQL to Linux Heartbeat.
Install PSQL Server on each cluster node and choose identical options for each installations. Do not install PSQL on the cluster shared storage, where the PSQL database(s) resides.
Groups pvsw and pvsw-adm must match pvsw Group ID and pvsw-adm Group ID, respectively, on the cluster nodes.
User psql must match psql UID on the cluster nodes.
On each cluster node, log in as user psql then create a directory that will be mounted to the shared storage. (User psql has no password and can only be accessed through the root account with the su command.) The name of the directory is your choice.
Configure the Heartbeat server on each of the nodes that will control the PSQL database engine. Configure the following:
Start-up. Specify the setting for when the Heartbeat Server starts. Set this to on, which means that the “server starts now and when booting.”
Linux Heartbeat provides a default user named hacluster for logging in to the Heartbeat Management Client. Assign a password to user hacluster on each of the nodes from which you want to run Heartbeat Management Client.
In the Heartbeat Management Client, add a new native item. For Belong to group, select the group you added for PSQL. For Type, select IPaddr.
On the resource you just added, specify the IP address of the cluster for the IP Value. Use the IP address assigned to the cluster (not the node) when Linux Heartbeat was installed and configured.
Add another new native item. For Belong to group, select the group you added for PSQL.
For Type, select Filesystem and delete the parameter fstype, which is not required. Add a new parameter and select “device” for Name. For Value, specify the device name of the shared storage, a colon, and the share mount location.
Add another new parameter and select “directory” for Name. For Value, specify the directory to use with the NFS mount.
Add another new native item. For Belong to group, select the group you added for PSQL. For Type, click “psql” with a Description of “PSQL OCF Resource Agent.” No additional parameters are required for the parameter.
Place all cluster nodes into standby mode except for the one from which you will run PCC. As user psql, start PCC on the one active node or from a client that can access the active node.
Access the properties for the server you just added. If prompted to log in, log in as user admin. Leave the password blank. Access the Directories Properties. For Transaction Log Directory, specify the directory that you created for the “log” location. For DBNames Configuration Location, specify the directory that you created for the “etc” location. See Create the Subdirectories on the Mounted Shared Storage.
From the operating system on one of the cluster nodes, log on as user psql and create the directory under the file system share where you want the database to reside. (If you create the directory as user root, ensure that user psql has read, write, and execute authority on the directory.)
As user psql, start PCC on the one active node or from a client that can access the active node. Create a new database for the server you added in Configure the Cluster Server in PCC. For Location, specify the directory you created where you want the database to reside. Specify the other database options as desired.
Managing PSQL in a Cluster Environment
After you install PSQL in a failover cluster environment, you can manage it as a resource. The following items discuss common management topics:
PSQL Licensing and Node Maintenance
The normal PSQL licensing and machine maintenance procedures also apply to the nodes in a failover cluster environment. Deauthorize the PSQL key before you modify the configuration of the physical or virtual machine where the database engine is installed. Reauthorize the key after changes are complete.
See To Deauthorize a Key and To Authorize a Key in PSQL User's Guide.
PSQL Failure Behavior
If a cluster node fails, a PSQL client does not automatically reconnect to the PSQL engine on the surviving node. Your application must reconnect the client to the PSQL database or you must restart the application. This applies even if Enable Auto Reconnect is turned on for the database engine.
If transaction durability is turned off and a failure occurs before a transaction completes, the transaction is automatically rolled back to its state before the transaction began. That is, to the last completed check point. The rollback occurs when the active server requests access to the data file.
If transaction durability was turned on, completed changes can be recovered that occurred between the time of the cluster node failure and the last check point. Transaction durability must be configured the same way on all nodes and the transaction log located on the shared storage. Transactions that had not completed at the time of the cluster failure, however, are lost even if transaction durability was in effect.
Stopping or Restarting the PSQL Transactional Service
A cluster failover occurs from the active node if you manually stop the PSQL transactional service through the operating system. If you are performing service node maintenance and want to avoid such a failover, stop the PSQL transactional service through the cluster utilities.
PSQL Configuration Changes
Some configuration changes require that you restart the database engine. See Configuration Reference.
Use the following steps in the Windows Cluster Administrator. You must do them in the order listed.
1
2
3
4
Software Patches
At some point, you may need to patch PSQL or the failover cluster software. To help you do so, Actian Technical Support provides a knowledge base article on this topic.