High-Availability Storage With GlusterFS on CentOs 7 and Oracle Linux 7

 
Install Distributed Filesystem "GlusterFS".
For example, create a distributed volume with 2 servers to be able to use it from GlusterFS Clients. This example shows to use 2 servers but it's possible to use more than 3 servers.
                                     +--------------------+
                            10.0.0.61|                    |
                               +-----+ GlusterFS Server#1 |
+-----------------+            | eth0|                    |
|                 |10.0.0.60   |     +--------------------+
| GlusterFS Clint |------------+
|                 |eth0        |     +--------------------+
+-----------------+            | eth0|                    |
                               +-----+ GlusterFS Server#2 |
                            10.0.0.62|                    |
                                     +--------------------+



Fuente:  http://www.server-world.info/en/note?os=CentOS_7&p=glusterfs

 [1]

Configure the same settings on 2 GlusterFS servers like follows. It is recommended to create a directory for GlusterFS volume on the different partition from the / partition. This example uses /glusterfs directory which is mounted from different partition from /


[root@gfs01 ~]#
wget http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo -O /etc/yum.repos.d/glusterfs-epel.repo

[root@gfs01 ~]# yum -y install glusterfs-server
[root@gfs01 ~]# systemctl start glusterd 
[root@gfs01 ~]# systemctl enable glusterd
[root@gfs01 ~]# vi /etc/hosts        # add GlusterFS servers


10.0.0.61   gfs01.server.world gfs01
10.0.0.62   gfs02.server.world gfs02


# create a directory for GlusterFS volume


[root@gfs01 ~]# mkdir  /glusterfs/distributed

 
 
 
[2]



Work on a server like follows.

[root@gfs01 ~]# gluster peer probe gfs02      # search the server
peer probe: success.
 

[root@gfs01 ~]# gluster peer status
 

Number of Peers: 1

Hostname: gfs02
Uuid: 89db2416-f997-479b-a016-a59130a78d13
State: Peer in Cluster (Connect)
 

   create a volume


[root@gfs01 ~]#
gluster volume create vol_distributed transport tcp \
gfs01:/glusterfs/distributed \
gfs02:/glusterfs/distributed

volume create: vol_distributed: success: please start the volume to access data
[root@gfs01 ~]# gluster volume start vol_distributed
# start the volume

volume start: vol_distributed: success
[root@gfs01 ~]# gluster volume info        # show info
Volume Name: vol_distributed
Type: Distribute
Volume ID: 2d2b282a-09df-462d-a6e3-42c0471708d6
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: gfs01:/glusterfs/distributed
Brick2: gfs02:/glusterfs/distributed

*************************************

create a volume with replication.


Este seria otro ejemplo de creacion de un Volumen con replicacion.


Next we create the share named testvol with two replicas (please note that the number of replicas is equal to the number of servers in this case because we want to set up mirroring) on server1.example.com and server2.example.com in the /data directory (this will be created if it doesn't exist):

gluster volume create testvol replica 2 transport tcp server1.example.com:/data server2.example.com:/data

[root@server1 ~]# gluster volume create testvol replica 2 transport tcp server1.example.com:/data server2.example.com:/data
Creation of volume testvol has been successful. Please start the volume to access data.
[root@server1 ~]#

Start the volume:

gluster volume start testvol
 
***************************************




[3]

Configure GlusterFS Clients to use GlusterFS volume from GlusterFS servers.

 

 

 

[root@gfsclient ~]# wget http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo -O /etc/yum.repos.d/glusterfs-epel.repo 
[root@gfsclient ~]# yum -y install glusterfs glusterfs-fuse
 
 

mount the volume on /mnt


[root@gfsclient ~]# mount -t glusterfs gfs01.server.world:/vol_distributed /mnt
 

[root@gfsclient ~]# df   -hat
Filesystem                          Type            Size  Used Avail Use% Mounted on
/dev/mapper/centos-root             xfs              46G  1.1G   45G   3% /
devtmpfs                            devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs                               tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs                               tmpfs           1.9G  8.3M  1.9G   1% /run
tmpfs                               tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vda1                           xfs             497M  120M  378M  25% /boot
gfs01.server.world:/vol_distributed fuse.glusterfs  160G   65M  160G   1% /mnt
 

Comentarios