12

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?

16

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.

  • 2
    What kind of performance issues are you seeing? – CMCDragonkai Jun 18 '14 at 3:17
  • 3
    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 '16 at 7:26
  • 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 – Diego Roccia Feb 2 '18 at 17:28
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

  • What about Master to Master replication on GlusterFS? – CMCDragonkai Jun 20 '14 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. – Ross Peoples Aug 16 '17 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 '18 at 5:12
2

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.

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.