Antonio Messina
2014-Feb-11 09:51 UTC
[Gluster-users] Question on replicated volumes with bricks on the same server
Hi all, I would like to know how gluster distribute the data when two bricks of the same volumes are on the same server. Specifically, I would like to know if there is any way to spread the replicas on different nodes whenever possible, in order not to lose any data if the node goes down. I did a simple test and it seems that the way replicas are spread over the bricks is related to the way the volume is created, that is if I create a volume with: gluster volume create vol1 replica 2\ gluster-data001:/srv/gluster/vol1.1 \ gluster-data001:/srv/gluster/vol1.2 \ gluster-data002:/srv/gluster/vol1.1 \ gluster-data002:/srv/gluster/vol1.2 replicas of a file will be stored on the two bricks of the same server, while if I create the volume with gluster volume create vol1 replica 2\ gluster-data001:/srv/gluster/vol1.1 \ gluster-data002:/srv/gluster/vol1.1 \ gluster-data001:/srv/gluster/vol1.2 \ gluster-data002:/srv/gluster/vol1.2 replicas will be saved on two bricks of different servers. So, my guess is that if I create a "replica N" replicated+distributed volumes using the bricks: gluster-1:/srv/gluster ... gluster-[N*M]:/srv/gluster gluster internally creates a distributed volumes made of the following replicated "volumes": replicated volume 1: gluster-[1..N]:/srv/gluster replicated volume 2: gluster-[N+1..2N]:/srv/gluster ... replicated volume M: gluster-[N*(M-1)+1..N*M]:/srv/gluster Is that correct or there is a more complex algorithm involved? .a. -- antonio.s.messina at gmail.com antonio.messina at uzh.ch +41 (0)44 635 42 22 GC3: Grid Computing Competence Center http://www.gc3.uzh.ch/ University of Zurich Winterthurerstrasse 190 CH-8057 Zurich Switzerland
Vijay Bellur
2014-Feb-12 10:21 UTC
[Gluster-users] Question on replicated volumes with bricks on the same server
On 02/11/2014 03:21 PM, Antonio Messina wrote:> Hi all, > > I would like to know how gluster distribute the data when two bricks > of the same volumes are on the same server. Specifically, I would like > to know if there is any way to spread the replicas on different nodes > whenever possible, in order not to lose any data if the node goes > down. > > I did a simple test and it seems that the way replicas are spread over > the bricks is related to the way the volume is created, that is if I > create a volume with: > > gluster volume create vol1 replica 2\ > gluster-data001:/srv/gluster/vol1.1 \ > gluster-data001:/srv/gluster/vol1.2 \ > gluster-data002:/srv/gluster/vol1.1 \ > gluster-data002:/srv/gluster/vol1.2 > > replicas of a file will be stored on the two bricks of the same > server, while if I create the volume with > > gluster volume create vol1 replica 2\ > gluster-data001:/srv/gluster/vol1.1 \ > gluster-data002:/srv/gluster/vol1.1 \ > gluster-data001:/srv/gluster/vol1.2 \ > gluster-data002:/srv/gluster/vol1.2 > > replicas will be saved on two bricks of different servers. > > So, my guess is that if I create a "replica N" replicated+distributed > volumes using the bricks: > > gluster-1:/srv/gluster > ... > gluster-[N*M]:/srv/gluster > > gluster internally creates a distributed volumes made of the following > replicated "volumes": > > replicated volume 1: gluster-[1..N]:/srv/gluster > replicated volume 2: gluster-[N+1..2N]:/srv/gluster > ... > replicated volume M: gluster-[N*(M-1)+1..N*M]:/srv/gluster > > Is that correct or there is a more complex algorithm involved? >The interpretation is correct. The way replica sets are chosen is related to the order in which bricks are defined at the time of volume creation. -Vijay