Back to home
Galera on freebsd (11.1 and up) A complete galera cluster on freebsd!
Finally the guys and girls developing the excellent galera cluster ported it to freebsd!
Here's how to install it!

Initial setup Install 3 boxes or vm's with a basic freebsd 11.1 install, freely downloadable at
Assign an ip to each and boot them
Next, do all the necessary updates etc. on the ports and install some nice to have utilities:
installation commands
#portsnap fetch extract
#cd /usr/ports/ports-mgmt/portmaster
#make install clean
#portmaster databases/mariadb102-server (make sure to select SSL in the config!!!)
#portmaster devel/boost-libs sysutils/lsof net/rsync
#portmaster databases/galera
#echo mysql_enable="YES" >> /etc/rc.conf
After this, start the mysql server using 'service mysql-server start'. Mariadb will come up with a first time installer, securing the database etc.

Galera configuration Stop the sql server.
Download the file: wsrep_sst_rsync and overwrite the one in /usr/local/bin, it has an error!
or, if you like to do things yourself, change that file:
wsrep_sst_rsync patch
#nano /usr/local/bin/wsrep_sst_rsync

-- look for the line saying: local is_rsync="$(echo $port_info | \
--                           grep -w '[[:space:]]\+rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)"

-- replace with:
	local is_rsync="$(echo "$port_info" | grep -w rsync.*"$rsync_pid" 2>/dev/null)"
Then create a my.cnf file in the folder /var/db/mysql
Examples can be found in /usr/local/share/mysql/. If you like any one of these, just copy it to /var/db/mysql.

Make the correct changes to the file:

wsrep_provider = /usr/local/lib/
wsrep_provider_options = "gmcast.segment=1;pc.weight=1"
wsrep_cluster_name = "mycluster"
wsrep_cluster_address = "gcomm://"
wsrep_sst_method = rsync

On the FIRST galera server in the cluster, change /etc/rc.conf so it will accept the other galera servers:
mysql_args="--wsrep-on --wsrep-new-cluster"
All the other galera servers in the cluster can be started after the first one is booted and running.

To verify if things are running, use the query:
Check cluster
SHOW STATUS LIKE 'wsrep_cluster_size'
-- or
The first query should be the correct amount of servers in the cluster if all are connected.