# MariaDB cluster on FreeBSD



## fred974 (Jun 13, 2017)

Hi all,

I curently host around 12 wordpress websites.
Each domain is a FreeBSD jail and run its own php and webserver.
However, all the webjail use the same database server which is hosted inside yet another jail.

So I have a big problem if my database jail fail, I lost everything which is really not good.
I would like to have a database cluster as follow..
2 database jail
1 external database from another jail on another server
1 databse server in our office

The problem that I have is that FreeBSD doesn't seem very popular n hosting databses..
I looked the web and cannot find anything that i can use for MariaDB cluster..
Galera is not working in FreeBSD 11 and Maxscale just doesn't seem to exist in FreeBSD.

What tools do you guys use?
Thank you all in advance


----------



## SirDice (Jun 13, 2017)

There's no real need for clustering (in the traditional sense). What you need are two MySQL (or MariaDB) servers, using master-master replication. Then use CARP or something similar so only one of them is "active" (this will prevent 'odd' replication errors). That will allow you to switch back and forth (useful for updates for example) and fail-over (in case one of the hosts dies) without much interuption of the service. If your load requires it you could add a couple of read-only slaves to that. The read-only slaves will take the brunt of load (most queries are typically SELECTs), the master-master combination can then be used for write-only access (INSERT, UPDATE, etc).


----------



## fred974 (Jun 13, 2017)

SirDice , can i do a master-master replication between 2 jails on the same host?


----------



## SirDice (Jun 14, 2017)

Yes, but that would defeat the purpose. What if that one host goes down (due to a hardware issue for example)?


----------

