15

I have been playing with glusterfs recently.

What I want to try is to run mysqld on top of the glusterfs in a similar way as it is possible to run MySQL on top of DRBD.

I am familiar with MySQL replication and the advantages of using that instead of this approach and I am also aware of MongoDB and other NoSQL solutions.

However, it would be an easy solution to a few specific projects I have coming up if I could leave MySQL as it is and replicate the underlying file system.

Is this possible and if it is where can I find out how?

5 Answers 5

20

Due to a reasonably long delay with no answers, I have found out by trial and error.

The answer is : Yes, I can run mysqld on top of glusterfs.

I set this up on Ubuntu and briefly here are the steps:

The real problem comes in how MySQL handles locks.

However you can pass all of this off to glusterfs to handle so that many mysqld processes (running on separate nodes) can access the same database files on /mnt/glusterfs. You need to read this carefully.

4
  • 2
    What kind of performance issues are you seeing? Jun 18, 2014 at 3:17
  • 6
    This is very interesting indeed! However, for the record, I'd strongly advise against using this in any situation where your data is important. Just because it seems to work doesn't mean it's safe. You might just be lucky and not have run into race conditions yet that could cause data loss.
    – jlh
    Apr 13, 2016 at 7:26
  • 2
    you're going to use 1 server at a time, right? I'm pretty confident it won't work from multiple servers. you're going to lose you're data Feb 2, 2018 at 17:28
  • Depends of your DB usage, it worked fine for me until one table went over 3GB, then the indexes started to be corrupted. I'm now looking for an alternative.
    – zzarbi
    May 12, 2023 at 6:29
5

In theory you can. In practice and especially regarding the performance, Gluster manual suggests that it is not intended to be used for replicating DB files or other fine-grain I/O systems.

See the Gluster official overview here:

http://docs.gluster.org/en/latest/Install-Guide/Overview/#is-gluster-going-to-work-for-me-and-what-i-need-it-to-do

Is Gluster going to work for me and what I need it to do?

... On the other hand, adding enough Gluster servers into the mix, some people have seen better performance with us than other solutions due to the scale out nature of the technology - Gluster does not support so called “structured data”, meaning live, SQL databases. Of course, using Gluster to backup and restore the database would be fine - Gluster is traditionally better when using file sizes at of least 16KB (with a sweet spot around 128KB or so).

Once more, if you want to have MySQL replication I suggest:

  1. Use traditional MySQL Master/Slave replication https://dev.mysql.com/doc/refman/5.7/en/replication.html

  2. Use Codership Galera cluster that nowdays is implemented in all flavors of MySQL like Oracle MySQL or MariaDB

5

Attempted this on a K8 cluster. MySQL running inside of a container, GlusterFS installed directly on the node (non-containerized). MySQL container had an affinity set to always run on the same node as GFS, mounting volume using K8's native GFS volume driver.

Experienced random high latency for WordPress sites, even with NGINX FastCGI (PHP-FPM) caching enabled. Switched over to hostPath volume for MySQL container, latency problems went away.

2

I do not think that is possible. Richard, the link you provided is talking about MyIsam and they say that is not recommended anyway. I read somewhere (I do not remember where) that using innoDB files shared by several nodes will lead to data corruption.

2

I don't know why you want to access the same DB files from different MySQL server processes but if the reason is performance you should have a look at Galera.

http://www.codership.com/content/using-galera-cluster

Integrated in Maria DB and Percona XTRA DB Cluster

3
  • 1
    What about Master to Master replication on GlusterFS? Jun 20, 2014 at 5:08
  • -1 for Galera unless you're looking for read-scalability. Galera is unsuitable for large databases, or databases where write performance matters. I speak from experience, and the recommendations from a support contract with MariaDB. Aug 16, 2017 at 13:18
  • @RossPeoples to be honest the OP is unlikely doing this for write performance. Gluster is likely to add latency to every transaction. He is probably more likely looking for HA, possibly by using a Kubernete to ensure that there is a single dB instance running.
    – Aron
    Sep 18, 2018 at 5:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .