The Geek Blog

View Original

Setting Up MariaDB replication using Vagrant

Following on from my other couple of quick introductions for setting up and using vagrant, you can see them below.

This is the first step in setting up MariaDB and setup database replication using Vagrant.  This example was all done on the Mac

The first thing we need to do is create the directories, change to where you want to store the machines, I use the default location ~/.vagrant.d/boxes.

So lets start, load terminal and type

See this content in the original post

Now you have the directories, you can type vagrant init to create the basic template, but I would copy the ones below

Master

See this content in the original post

Slave

See this content in the original post

Now you have the machines ready to fire up, but before we do in each of the directories, you need to create playbook.yml in both the master and slave directory.

As you can tell from the files, you have two machines, one named Master and one named Slave, they will have distinct IP addresses as well.

See this content in the original post

Once you have saved the file, you are ready to fire up the machines, this will automatically create the MariaDB repo file and install MariaDB for you so you will have a working machine.  In the next step we will configure MariaDB and setup and test the databases.