MySQL Fabric will be used set up a three node High Availability server farm and this is the second part of a series. If you missed the last post, I will be doing a live demo (gulp!) on Fabric for the Triangle MySQL User Group in Raleigh. But part of the pain of live demos is how do you get multiple servers set up to make a server farm. E-I-E-I-oh?
Of course getting the slaves up on one laptop and running correctly is the biggest expenditure of time for this demo. For this I will use Vagrant. I am using Vagrant to set up three identical servers using VirtualBox to provide the servers I need for the demo. I am using Ubuntu.
sudo apt-get install vagrant VirtualBox
vagrant box add db1 https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/14.04/ubuntu-14.04-amd64.box
vagrant init db1
Then I created db2 and db3 using the last two steps. Be sure to add the vbguest plugin so you can have a shared folder and some otehr features.
vagrant plugin install vagrant-vbguest
There is a problem with the current Vagrant for getting a shared folder to work (hint — shared folder for your files you want to install on the farm server like the MySQL 5.6 tarball).
To get the shared folder to work, boot the servers and then
sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions .
The Vagrantfile is where the three boxes are defined and the interesting parts follows:
config.vm.define "db1" do |db1|
db1.vm.box = "db1"
db1.vm.network :private_network, ip: "10.10.13.10"
config.vm.define "db2" do |db2|
db2.vm.box = "db2"
db2.vm.network :private_network, ip: "10.10.13.20"
config.vm.define "db3" do |db3|
db3.vm.box = "db3"
db3.vm.network :private_network, ip: "10.10.13.30"
This provides three boxes creatively named db1, db2, and db3 on a private ’10’ network.
The nest step it to run vagrant up, ssh to each of the boxes, and make things ready for installing MySQL. This includes apt-getting libaio1, adding the address to /etc/host and setting the hostname. Then install MySQL 5.6 and setup a user named fabric on each instance.
The next post will cover setting up the HA Fabric farm.