Search code examples
mariadbgaleramaxscale

Scaling Mariadb Galera Cluster


I have installed MariaDB Galera Cluster on ubuntu 14 and it is working fine.

See the tutorial

I have 3 nodes (each 500GB HDD capacity) mariadb cluster and all replications are working perfect.

My questions are :

When I run out of disk space after few years, What is the exact way to increase the capacity of the database?

Is it possible to add extra nodes and increase the database HDD capacity? I heard about MaxScale, but I can't figure it out to work on

Can anyone explain this according to above configuration.

This is a MaxScale Simple Sharding with Two Servers


Solution

  • Assuming the 500GB is the problem...

    Plan A:

    1. Take a node out of rotation.
    2. Upgrade the disk drive(s) to bigger ones.
    3. Put the node back in rotation. SST will occur, and that one node will now have more space.
    4. Repeat for each other node.

    Plan B:

    1. Get a new machine with a bigger drive(s).
    2. Add it to the Cluster. The new machine will do an SST.
    3. Repeat with more new machines.
    4. Permanently remove the old machines.

    Plan B will probably also add more cores, etc. (But you did not mention the need for such.)

    Both of these methods have no more downtime than loss of a single server (3 times), which you already know about and can easily handle.

    If you want to Shard the data, that would involve multiple clusters. Sharding is not warranted unless the write capacity of the Cluster is about to be exceeded. And Sharding is not a trivial task.

    Another way to 'expand' disks... With a RAID controller (better than RAID software), you can improve the performance of the disk subsystem via "striping". Usually people go with RAID-5 or RAID-10 to get parity to allow for seamless recovery from a dead drive. However, Galera effectively handles dead drives by letting you repair any part of a server without losing the system. So RAID-0 is arguably more cost-effective.

    Some operating systems also let you logically treat multiple drives as a single big filesystem. This does not give you the performance boost of striping, but it does let you (I think) add a drive without having to reinstall the OS, software, and data.

    A RAID controller with Battery Backed Write Cache has the extra advantage of making writes "instantaneous" even without risking loss due to power failure.