NOTE: This documentation is currently outdated for the Kubernetes-based Dramble revision. Please follow the GitHub issue Don't Make MySQL a Pet to follow progress in making a more robust HA version of Drupal's Database running inside the Dramble Kubernetes cluster.
One of the main reasons behind using a high availability architecture like the one used with the Dramble is the redundancy on the database server. Using a master-replica or master-master setup allows you to switch over to the secondary server quickly in case of a major issue on the primary database server.
The Pi Dramble project includes a playbook that automatically switches all the required settings to the replica server, and makes sure the replica resets itself as the new 'master' server.
To run this playbook (after you've deployed Drupal to the cluster), you can run the command:
$ ansible-playbook -i inventory playbooks/drupal/mysql-failover.yml
The failover playbook sets the replica server as the new master, then switches Drupal's settings.php file to point to this new master.
To switch back to the original layout, you can do the following:
- Run the main playbook:
ansible-playbook -i inventory main.yml
- Run the Drupal deployment playbook:
ansible-playbook -i inventory playbooks/drupal/main.yml