MySQL Group Replication: A small Corosync guide

MySQL Group Replication is here and with it comes the need to install and configure the underlying group communication toolkit that supports it: Corosync. Corosync is a well known and reliable Group Communication System that is used in such applications as Pacemaker.

“We develop MySQL Group Replication based on Corosync version 2.3.3, so this tutorial is based on this version. Regardless of this, no known problems are know to exist when using different versions, but no extensive testing has been done on those.”

Along with Corosync we also encourage enabling secure communication, that in Corosync is achieved with NSS, to protect your data that is transmitted in the group.

Installing

To install Corosync, you can rely on your packet manager for most distributions or compile it from source.

==> From the package manager

  • Debian distributions

  • RPM based distributions

==> From source

To compile it from source, first download Corosync version 2.3.3 from

Then, follow the INSTALL file inside tarball.
To perform this task you should need NSS headers installed in the system, and LibQB.

 

Configuring

==> Configure network, logging and security options

The first part when configuring Corosync is to edit its main configuration file that is on:

You should have an example configuration on the folder you can use, and
information exists online and on the man pages about each one of the fields.
Hence, here we only present information about the basics to get you running.
To use the example file, just rename it with:

First of all there are several main set of configurations you can find on this file: totem, logging, quorum, nodelist and qb. We only cover the basic options.

On totem to the default options you should activate encryption with

This are our suggested defaults, but other algorithmic options exist for these options.

Below you should configure your network interface settings

On the logging section you can set where Corosync prints its messages. You can chose it to print to  file, to standard output or syslog and what the log level is.

==> Create configuration files to give users access to Corosync

Next step is to create uidgid files that identify which users can run Corosync. For each one of these users:

Create a file with a name at your choice, fill it with:

and place it under

==> Generate a cryptographic key for Corosync (when using encryption)

Run the following command as root:

Then copy the generated key to all group machines, and place it under the corosync configuration folder.

==> Configure Corosync to start at boot

  • Debian distributions:

Go to file:

and check that you have:

  • RPM based distributions:

Run as root:

 

Run it

==> Start corosync daemon

Note that, in some systems (e.g. Ubuntu), if you choose not to start Corosync at boot time, the configuration will stop this command from working.
Alternatively, you can start corosync with the command

==> Check that Corosync daemon is running

Conclusion

I hope this suffices in order to get you running. If you encountered a problem, please let’s us know. Happy testing!

About Pedro Gomes

Who am I? I'm a replication developer @ MySQL since 2013, and a fan of all things distributed so it's hard not to love my job. Raised on the distributed lab of Minho's University, home of great academic research on the field, I joined Oracle following this same passion and here I am!

2 thoughts on “MySQL Group Replication: A small Corosync guide

Leave a Reply

Your email address will not be published. Required fields are marked *

Please enter. * Time limit is exhausted. Please reload CAPTCHA.