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 Answers5

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.

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.

Aman B.
  • 51
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.

rtacconi
  • 745
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