I am currently having a closer look at GlusterFS.
For testing reasons, I set up four virtual machines in total, each of them act as a Gluster peer.
Since I have access to two DCs (which are located at different locations), I have created two of the Gluster nodes in DC A and the other two nodes reside in DC B.
A replicated volume with a replica count of 4 uses all of the four Gluster nodes which means I have two copies of each file in every DC.
Both DCs are connected with each other which means that each server has a way of accessing the other server via an internal IP address.
Since I also want to access the files, I created another VM in DC A which did a mount.glusterfs on the replicated volume.
Now my question is: Does the GlusterFS "client" prefer local Gluster nodes (from the same DC) over more distant Gluster nodes (located in the other DC)?
If not, is there a way of influencing the file access behavior of the "Gluster client"? I tried searching the official documentation and googled for over 30 minutes; however, I was not able to find answers to my questions.
The reason why I am asking this question is because I want to make sure that my "client" does not access the Gluster nodes in the other DC for accessing the files. I want to keep the traffic inside of the current DC.
Updated for 2020:
As of gluster release 7 (2019-NOV-13), clients perform network latency based read selection with load balancing. In this case it will prefer local nodes.
In versions between 2015 and 2019, the read-subvolume/read-subvolume-index options seem to have been long-since deprecated, though NUFA local-volume-name seems to perform the same kind of local preference.
Original answer:
The read option you are looking for is
read-subvolume
. Without it, on initialization, it will get the quickest to respond server (which may be DC-local, but that's not always true) and read from that. For writing, a client will always write to all nodes in a replica set.The read-subvolume option is documented here:
http://www.gluster.org/community/documentation/index.php/Translators/cluster