Configure MySQL
We are ready to go a step further and start with the configuration of MySQL.
First inititate MySQL for the first run:
mkdir /var/log/mysql
chown -R mysql:mysql /var/log/mysql
Now we can start mysql for the first time:
chkconfig mysqld on && service mysqld start
Create a MySQL restore set
To make it later on possible to install configure Interworx without messing up the Galera installation we have to copy some file to a secure location (on all nodes):
service mysqld stop
mkdir /tmp/interworx /tmp/interworx/etc/
cp /etc/my.cnf /tmp/interworx/etc/my.cnf
mkdir /tmp/interworx/etc/init.d
cp /etc/init.d/mysqld /tmp/interworx/etc/init.d/mysqld
mkdir /tmp/interworx/usr /tmp/interworx/usr/bin
cp /usr/bin/mysqld_safe /tmp/interworx/usr/bin/mysqld_safe
mkdir /tmp/interworx/usr/libexec
cp /usr/libexec/mysqld /tmp/interworx/usr/libexec/mysqld
mkdir /tmp/interworx/var/ /tmp/interworx/var/lib
cp -r /var/lib/mysql /tmp/interworx/var/lib
Galera-Configuration
To configure the Galera Cluster we go to the http://www.severalnines.com/galera-configurator/ website. We picked the following settings, but change according to your requirements:
Vendor: Codership (based on MySQL 5.5) Infrastructure: Other Operating System: RHEL6 - Redhat 6.3/Fedora/Centos 6.3/OLN 6.3/Amazon AMI Platform:Linux 64-bit (x86_64) Number of Galera Servers: 3+1 MySQL PortNumber: 3333 (haproxy, interworx on 3306) Galera PortNumber: 4567 Galera SST PortNumber: 4444 SSH PortNumber: 22 OS User: root MySQL Server password: pw4mydatabase CMON DB password: pw4myCMON Firewall (IPTables): Disable System Memory: 16 Gb WAN: no Skip DNS Resolve: no Database Size: < 8GB MySQL Usage: High write/High read Number of cores: 16 Max connections per server: 1500 Innodb_buffer_pool_size: 11319 Innodb_file_per_tabel: yes ClusterControl Server: 172.20.0.1 Apache user: apache WWWROOT: /var/www/html/ Config directory: /etc/ Server-ID 1: 172.20.0.2 Datadir: /var/lib/mysql Server-ID 2: 172.20.0.3 Server-ID 3: 172.20.0.4 Email address: your@email.com
Click on Generate Deployment Scripts and retrieve them from your mailbox shortly after.
Install Galera Cluster
Now we are ready to install the Galera cluster software
cd /usr/local/src/
wget http://www.severalnines.com/galera-configurator/tmp/bhhrgonbsft2e3o2vhlt0ip9v0/s9s-galera-2.2.0-rpm.tar.gz
tar xvfz s9s-galera-2.2.0-rpm.tar.gz
cd s9s-galera-2.2.0-rpm/mysql/scripts/install
Before running the installer change the following:
echo "local_mysql_port=3333" >> ../../config/cmon.cnf.agent
echo "local_mysql_port=3333" >> ../../config/cmon.cnf.controller
echo "local_mysql_port=3333" >> ../../config/cmon_rrd.cnf
and add the bold line to the files ../../config/my.cnf and ../../config/my.cnf.cmon
[MYSQLD] old-passwords=1