Now that we have the EC2 instances prepared it’s time to run the Severalnines’s Galera Configurator and generate the deployment scripts to be run from the ClusterControl instance.
Go to http://www.severalnines.com/galera-configurator/ and create a Galera deployment package. The wizard should be pretty self explanatory.
Select Amazon EC2 as the cloud provider and the OS used for your instances.
Enter the OS user as ‘ubuntu’ if you use debian/ubuntu based distributions or ‘root’ for rhel/centos variants.
Here you should enable ‘Skip DNS Resolve’ and select a system memory size that is close to your Galera instance types, in our case m1.large.
The InnoDB buffer pool and other specific settings can be changed to better suite your workload and requirements. Just remember to change the MySQL configuration file before running the deployment script.
There are some settings like the InnoDB log file size that is easier to change before deploying although you can do that later as well but currently requires some manual steps.
Enter the IP address for the ClusterControl instance and the location of your passwordless ssh key that you copied over to or generated for the ClusterControl instance.
Enter the IP addresses for the Galera instances and make sure to change the default data directory path from ‘/mnt/data/mysql’ to ‘/data/mysql’ or to whatever path that you have mounted as the data volume for the database files.
Finally enter an email address and click on the ‘Generate Deployment Scripts’.
Deploy and bootstrap a Galera Cluster
When you get the deployment package unpack it on the ClusterControl instance.
$ scp s9s-galera-2.10.tar.gz firstname.lastname@example.org:~/ $ ssh -i <your aws pem file> 220.127.116.11 $ tar zxvf s9s-galera-2.10.tar.gz
The my.cnf file that is initially used by all Galera is located under ~/s9s-galera-2.1.0/config.
Before running the deployment script you might want to take a few minutes to change some settings in the MySQL configuration file to better suite your workload.
Deploy and bootstrap
$ cd s9s-galera-2.1.0/mysql/scripts/install $ bash ./deploy.sh 2>&1 |tee cc.log
This could take up to about 10-15 minutes depending on your network.
After the deployment script completes you should now be able to view your Galera cluster by going to the web application on the ClusterControl instance,
http://18.104.22.168/cmon with your web browser.
Secure the Web application
If you want to secure the ClusterControl web interface you can try below script or follow our directions here: http://support.severalnines.com/entries/20637072-password-protecting-the-web-interface
Note: This script needs more testing...
#!/bin/bash os=debian if [ "$os" = debian ] then www=/var/www/cmon www_user=www-data www_srv=apache2 else www=/var/www/html/cmon www_user=httpd www_srv=httpd fi htpasswd -cm $www/.htpasswd admin cat >> "$www/.htaccess" << EOF AuthType Basic AuthName "CMON" AuthUserFile $www/.htpasswd Require valid-user EOF chown $www_user:$www_user $www/.htaccess chmod 644 $www/.htaccess if [ "$os" = "debian" ] then sed -ibak s#AllowOverride None#AllowOverride All#g /etc/apache2/sites-available/default else sed -ibak s#AllowOverride None#AllowOverride All#g /etc/httpd/conf/httpd.conf fi service $www_srv restart