GLUSTERFS

GlusterFS is designed for today’s high-performance, virtualized cloud environments. Unlike traditional data centers, cloud environments require multi tenancy along with the ability to grow or shrink resources on demand.

 

Server used here for glusterfs for filesystem Replication

  owncloud1.juhu.zedo.com 172.16.1.217

  owncloud2.juhu.zedo.com  172.16.1.67

 

Installation of GlusterFS on Both Nodes owncloud1 and owncloud2

 

I have installed here glusterfs-3.6.9

root@owncloud1:~/glusterfs-3.6.9#./configure –prefix=/home/glusterfs

root@owncloud1:~/glusterfs-3.6.9# make

root@owncloud1:~/glusterfs-3.6.9# make install

 

Then, ensure that GlusterFS was properly installed on the two nodes (owncloud_1 and owncloud _2) using the following command:

 

root@owncloud1:/home/glusterfs/sbin# ./glusterfs –version

glusterfs 3.6.9 built on Mar 17 2016 20:28:24

 

Lets create Glusterfs Server Volume entry on owncloud1 and Owncloud2 server ( note contents of the file must be same on both the server )

 

Create directory /home/owncloud/glusterfs/dataowncloud

#mkdir -p /home/owncloud/glusterfs/dataowncloud

 

root@owncloud1:/home/glusterfs/etc/glusterfs# vi glusterfs_server_owncloud.vol

#!/bin/bash

volume owncloud1_owncloud_posix

 type storage/posix                                                 # POSIX FS translator

 option directory /home/owncloud/glusterfs/dataowncloud                              # Export this directory

end-volume

 

volume owncloud1_owncloud_locks

 type features/locks

 subvolumes owncloud1_owncloud_posix

end-volume

 

volume owncloud1_owncloud

 type performance/io-threads

 option thread-count 64

 subvolumes owncloud1_owncloud_locks

end-volume

 

volume server

 type protocol/server

 option transport-type tcp

 option transport.socket.nodelay on

option auth.addr.owncloud1_owncloud.allow 172.16.1.* # Allow access to “owncloud1” volume

 

subvolumes owncloud1_owncloud

end-volume

 

Lets create Glusterfs Client entry on owncloud1 and owncloud2 server ( note: Same file must be on both the servers with same contents )

 

root@owncloud1:/home/glusterfs/etc/glusterfs# vi glusterfs_client_owncloud.vol

 

volume owncloud1_owncloud

 type protocol/client

 option transport-type tcp

 option remote-host 172.16.1.217           # IP address of the remote brick

 option ping-timeout 10                  # seconds to wait for a reply

 option remote-subvolume owncloud1_owncloud

 option transport.socket.nodelay on

end-volume

 

volume owncloud1_owncloud_backup

 type protocol/client

 option transport-type tcp

 option remote-host 172.16.1.67                 # IP address of the remote brick

 option ping-timeout 10                        # seconds to wait for a reply

 option remote-subvolume owncloud1_owncloud_backup  # Remote Volume name

 option transport.socket.nodelay on

end-volume

 

#The replicated volume with data

volume afr

type cluster/replicate

subvolumes owncloud1_owncloud owncloud1_owncloud_backup

end-volume

 

volume stat-prefetch

type performance/stat-prefetch

subvolumes afr

end-volume

 

### Add readahead feature

volume readahead

 type performance/read-ahead

 option page-count 16       # cache per file  = (page-count x page-size)

 subvolumes afr

end-volume

 

### Add IO-Cache feature

volume iocache

 type performance/io-cache

 option cache-size 1024MB

 subvolumes readahead

end-volume

 

### Add writeback feature

volume writeback

 type performance/write-behind

 option cache-size 128MB

 option flush-behind off

 subvolumes iocache

end-volume

 

volume iothreads

 type performance/io-threads

 option thread-count 16 # default is 16

 subvolumes readahead

end-volume

 

Now lets add the glusterfs  server and client startup in /etc/init.d on both server

 

CLIENT:

 

Create mount point:

root@owncloud1:mkdir -p /home/owncloud/gluster-mount-data

 

root@owncloud1:/etc/init.d# vi glusterfs-client.sh

/home/glusterfs/sbin/glusterfs -f /home/glusterfs/etc/glusterfs/glusterfs_client_owncloud.vol /home/owncloud/gluster-mount-data -l /home/glusterfs/var/log/glusterfs/gluster-client.log

 

root@owncloud1:/etc/init.d# vi glusterfsd ( just edit the below part )

SERVER:

Edit this part

root@owncloud1:/etc/init.d# vi glusterfsd

PATH=/sbin:/usr/sbin:/bin:/usr/bin

NAME=glusterfsd

SCRIPTNAME=/etc/init.d/$NAME

DAEMON=/home/glusterfs/sbin/$NAME

PIDFILE=/var/run/$NAME.pid

CONFIGFILE=/home/glusterfs/etc/glusterfs/glusterfs_server_owncloud.vol

LOGFILE=/home/glusterfs/var/log/glusterfs/glusterfs-server.log

 

=============================================================

 

Now start the server and client on both the servers

 

root@owncloud1:/etc/init.d# update-rc.d glusterfsd defaults

root@owncloud1:/etc/init.d# update-rc.d glusterfs-client.sh defaults

 

root@owncloud1:~# /etc/init.d/glusterfsd start

root@owncloud1:/etc/init.d# ./glusterfs-client.sh

 

You can now see the mount point

root@owncloud1:/etc/init.d# df -h | grep glus

/home/glusterfs/etc/glusterfs/glusterfs_client_owncloud.vol   37G  2.7G   32G   8% /home/owncloud/gluster-mount-data

 

Configuring the nodes for communication

 

Now both the servers want to communicate with each other by editing the entries in /etc/hosts using the following command if the DNs entry are not added.

 

Vi /etc/hosts

172.16.1.217    owncloud1.juhu.zedo.com owncloud1

172.16.1.67     owncloud2.juhu.zedo.com owncloud2

 

Ensure that the GlusterFS nodes are properly communicating with each other.

 

Touch file on /home/owncloud/gluster-mount-data on owncloud1.

 

root@owncloud1:~# touch /home/owncloud/gluster-mount-data/test

 

You can see the same file created on owncloud2 server at same path.

root@owncloud2:/home/owncloud/gluster-mount-data# ls

test

 

ote: Here each server is acting as glusterfs server and client

 

MAKE GLUSTERFS MOUNT POINT and VOLUME PATH READ and WRITE by Postgres and Owncloud Users

 

root@owncloud1:~# groupadd useowncloud

root@owncloud1:~# usermod -a -G useowncloud postgres

root@owncloud1:~#  usermod -a -G useowncloud owncloud

root@owncloud1:~# chgrp -R useowncloud /home/owncloud/glusterfs

root@owncloud1:~# chmod -R 770 /home/owncloud/glusterfs

root@owncloud1:~#  chgrp -R useowncloud /home/owncloud/gluster-mount-data

root@owncloud1:~# chmod -R 770 /home/owncloud/gluster-mount-data

 

Advertisements