Atom feed of this document
  
 

 MySQL with Galera

Rather than starting with a vanilla version of MySQL and then adding Galera to it, you will want to install a version of MySQL patched for wsrep (Write Set REPlication) from https://launchpad.net/codership-mysql/0.7. Note that the installation requirements are a bit touchy; you will want to make sure to read the README file so you don’t miss any steps.

Next, download Galera itself from https://launchpad.net/galera/+download. Go ahead and install the *.rpms or *.debs, taking care of any dependencies that your system doesn’t already have installed.

Once you’ve completed the installation, you’ll need to make a few configuration changes:

In the system-wide my.conf file, make sure mysqld isn’t bound to 127.0.0.1, and that /etc/mysql/conf.d/ is included. Typically you can find this file at /etc/my.cnf:

[mysqld]
...
!includedir /etc/mysql/conf.d/
...
#bind-address = 127.0.0.1

When adding a new node, you must configure it with a MySQL account that can access the other nodes so that it can request a state snapshot from one of those existing nodes. First specify that account information in /etc/mysql/conf.d/wsrep.cnf:

wsrep_sst_auth=wsrep_sst:wspass

Next connect as root and grant privileges to that user:

$ mysql -e "SET wsrep_on=OFF; GRANT ALL ON *.* TO wsrep_sst@'%' IDENTIFIED BY 'wspass'";

You’ll also need to remove user accounts with empty usernames, as they cause problems:

$ mysql -e "SET wsrep_on=OFF; DELETE FROM mysql.user WHERE user='';"

You’ll also need to set certain mandatory configuration options within MySQL itself. These include:

query_cache_size=0
binlog_format=ROW
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
innodb_doublewrite=1

Finally, make sure that the nodes can access each other through the firewall. This might mean adjusting iptables, as in:

# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source <my IP>/24 --destination <my IP>/32 --dport 3306 -j ACCEPT
# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source <my IP>/24 --destination <my IP>/32 --dport 4567 -j ACCEPT

It might also mean configuring any NAT firewall between nodes to allow direct connections, or disabling SELinux or configuring it to allow mysqld to listen to sockets at unprivileged ports.

Now you’re ready to actually create the cluster.

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page

loading table of contents...