Issue link: https://read.uberflip.com/i/1334488
In the Datacenter 232 Configuring HA Proxy for MySQL Galera load balancing With our MySQL Galera cluster configured, each of the nodes is able to take traffic, and the writes are seamlessly replicated to other nodes in the cluster. We could use any of the MySQL node addresses and place them in our configuration files, but if that node failed, we would not have a database to attach to and our OpenStack environment would fail. A solution to this is to front the MySQL cluster using load balancing. Given that any of the nodes are able to take reads and writes, with data consistency, load balancing is a great solution. The steps in the following section configure a highly available 2-node HA Proxy setup that we can use as a MySQL endpoint to place in our OpenStack configuration files. In production, if load balancing is desired, it is recommended that dedicated HA load balancers be used. Getting ready Configure two servers, both running Ubuntu 12.04, that are configured on the same network as our OpenStack environment and MySQL Galera cluster. In the following steps, the two nodes will be on IP addresses 172.16.0.20 and 172.16.0.21, with a floating IP address (that has been set up using keepalived) of 172.16.0.30. This address is used when we configure database connections in our OpenStack configuration files. How to do it... To configure HA Proxy for MySQL Galera load balancing, carry out the following steps: Installation of HA Proxy for MySQL 1. As we are setting up identical servers to act in a pair, we will configure a single server first, and then repeat the process for the second server. We first install HA Proxy using the usual apt-get process, as follows: sudo apt-get update sudo apt-get -y install haproxy 2. With HA Proxy installed, we'll simply configure this first proxy server appropriately for our MySQL Galera cluster. To do this, we edit the /etc/haproxy/haproxy.cfg file with the following contents: global log 127.0.0.1 local0 log 127.0.0.1 local1 notice #log loghost local0 info maxconn 4096 #chroot /usr/share/haproxy www.it-ebooks.info

