The PostgreSQL database is a core component of the QVD system. Postgres provides a robust and flexible base and the QVD-DB is the glue that binds the VDI together, keeping track of both configuration and runtime information. As such, it’s essential to keep the QVD-DB operable at all times, preferably with automatic failover. Combined with the sturdy core of the QVD system, a rock solid database will give you a dependable VDI that you and your users can rely upon.
Configuring a High Availability Database with QVD (html) (pdf) is a new addition to our documentation page with this in mind. It’s a guide to configuring QVD with a High Availability Postgres cluster using Pacemaker with Corosync and DRBD.
The system will be set up for automatic failover, meaning that a passive server will take over the operation of the database in the event of a failure on the active node.
The cluster HOWTO was written and tested on SUSE Linux Enterprise Server 11 SP2 but should be readily adaptable to Ubuntu, our other supported platform, with a little care and consideration.
The cluster uses DRBD which provides something similar to a network based RAID 1, mirroring a disk or partition containing the database data and configuration across the network. Due to the critical nature of this syncing, and to avoid the so called “split-brain” scenario whereby each node thinks itself the primary resource of the data, we strongly recommend using a crossover cable for this network, to take potential network and switch failures out of the equation.
Pacemaker provides resource management across the nodes, starting and stopping services and, equally importantly, making sure that the services are only running on the active node to prevent data corruption. To do that, it uses Corosync, which acts as a messaging layer between the nodes, something akin to a network dbus. The cluster also uses STONITH to ensure that any node that is not responding properly is shut down immediately, avoiding data corruption.
The setup itself can be fairly convoluted but is easy enough to understand once the role of each component is fully understood. We have used a wealth of documentation to compile our own guide and you are encouraged to read the articles in the resources section for a better understanding of this important topic.