glusterfs 3.5


A Distributed File System is a file system that allows multiple clients to concurrently access data across multiple servers or bricks in a trusted storage pool

GlusterFS uses a native FUSE-based client to export the file system, but it can also be configured to use NFS and CIFS to export the storage system to client hosts that cannot use the native client (FUSE).
GlusterFS is a powerful network/cluster filesystem running in user space that uses FUSE to connect 

with the VFS layer in the OS. GlusterFS is a File System itself that uses already tried and tested 

disk file systems like ext3, ext4, xfs, etc. to store the data. It can easily scale up to petabytes 

of storage which is available to user under a single mount point .

FUSE is a loadable kernel module for UNIX-like operating systems. It enables non-privileged users to create their own file systems without editing kernel code. This is achieved by running file system code in user space, while the actual FUSE module provides a bridge to kernel. 

Terms.

brick  - A locally attached filesystem (e.g. xfs on top of LVM) that is part of a volume.For example, if a server named storage1.example.com had a local storage mounted under /mnt/disk1, a brick would be referred to as storage1.example.com:/mnt/disk1.
client - The machine which mounts the volume.
server - The machine which hosts the filesystem in which data will be stored.
volume - A Network available filesystem which can be mounted using native GlusterFS, NFS, CIFS, it is a logical collection of bricks. Most management operations in GlusterFS happen on the volume level.

etc.


apt-get install xfsprogs
apt-get install software-properties-common
sudo add-apt-repository ppa:gluster/glusterfs-3.5
apt-get update
sudo apt-get install glusterfs-server


<if vmware used and additional harddisk is used , to detect new disk added without restart run 
below command>
#ls /sys/class/scsi_host/ | while read host ; do echo "- - -" > /sys/class/scsi_host/$host/scan ; done


fdisk /dev/sdb
...make new partition as lvm

pvcreate /dev/sdb1

vgcreate vg10 /dev/sdb1

lvcreate -L 1G vg10 -n lvmhome
OR
lvcreate -l 100%FREE -n lvmhome testvg
mkfs.xfs -i size=512 /dev/mapper/vg10-lvmhome 

#Mount the new lvm to /public directory on both servers
mkdir -p /public/sdb1
mount -t xfs  /dev/mapper/vg10-lvmhome /public/sdb1
echo "/dev/mapper/vg10-lvmhome /public/sdb1 xfs defaults 0 0" >> /etc/fstab 

#gluster peer status
Number of Peers: 0

Creating a trusted storage pool.
A trusted storage pool consists of the storage servers that will comprise the volume, in other 
words it is a trusted network of storage servers. When you start the first server, the storage pool 
consists of that server alone. To add additional storage servers to the storage pool, you can use 
the probe command from a storage server that is already trusted. The GlusterFS service must be 
running on all storage servers that you want to add to the storage pool.

Example 
( To create a trusted storage pool of four servers, add three servers to the storage pool from 

server gnode1 )

1. Probe the servers you want to add to the storage pool  on only one primary server eg here gluster1

root@gluster1:~# gluster peer probe gluster2
peer probe: success. 

Note: Do not self-probe local host - gluster1.

@gluster1 server
root@gluster1:~# gluster peer status
Number of Peers: 1

Hostname: gluster2
Uuid: 925b360f-a85d-44b8-87d1-94a0c4270e17
State: Peer in Cluster (Connected)

@gluster2 server
root@gluster2:~# gluster peer status
Number of Peers: 1

Hostname: 192.168.163.139
Uuid: 4f5f5a70-be91-4754-889b-ca0e708c0be3
State: Peer in Cluster (Connected)

Now that we have a trusted storage pool consisting of 4 servers lets create the Volumes that we can 
actually use to store files later on.
 Run below command in only one primary server

@gluster1#gluster volume create gvola replica 2 gluster1:/public/sdb1/brick/ gluster2:/public/sdb1/brick/

another example 
cat /etc/fstab   "on all nodes"
 /dev/sdb1  /export/disk1  xfs defaults 0 0
run `mkdir  /export/disk1/brick` on all nodes

# gluster volume create GWEB replica 3 mx1:/export/disk1/brick/  mx2:/export/disk1/brick/  mx3:/export/disk1/brick/

@gluster1# gluster volume start gvola
volume start: gvola: success
To confirm , make sure you see volume started.
#gluster volume info
 Volume Name: gvola
Type: Replicate
Volume ID: c29b0f57-c018-4d4e-9bdc-2dda6f122dfc
Status: Started
OR run #gluster volume status


Note: If the volume is not started, clues as to what went wrong will be in log files under /var/log/glusterfs on one or both of the servers - usually in etc-glusterfs-glusterd.vol.log

Allowing client to mount

#gluster volume set gvola auth.allow 192.168.163.141

At client side
modprobe fuse
to make sure fuse is loaded into kernel
dmesg | grep fuse

apt-get install glusterfs-client   <make sure version of client and server match>

Finally mounting the filesystem:-

mount -t glusterfs gluster1:gvola /mnt


Expanding Volume by adding Bricks  

 

 

Removing Brick

gluster volume rebalance GWEB stop   #stop rebalance if runing

gluster volume remove-brick GWEB replica 3 mx1:/export/disk2/brick mx2:/export/disk2/brick mx3:/export/disk2/brick start    #use "force" instead of "start"
























No comments:

Post a Comment