Sunday, July 20, 2014

How to install GlusterFS on Debian 7 wheezy

This tutorial I will explain GlusterFS configuration in Debian 7.6.0 and You can use this tutorial for ubuntu. GlusterFS is an open source distributed file system which provides easy replication over multiple storage nodes. Gluster File System is a distributed filesystem allowing you to create a single volume of storage which spans multiple disks, multiple machines and even multiple data centres.

How to use it? It simply.Please follow this step below.

Prerequisites
  • 2 x Debian 7 Server
  • IPaddr and hostname for all server
    I use :
  • Server 1 ipaddr : 192.168.207.129
    Server 1 hostname : debian7n1
  • Server 2 ipaddr : 192.168.207.130
    Server 2 hostname : debian7n2
     Install GlusterFS
The next step is to make the all machines server.
     


$ su -
# wget -O - http://download.gluster.org/pub/gluster/glusterfs/3.5/3.5.1/Debian/pubkey.gpg | apt-key add -
# echo deb http://download.gluster.org/pub/gluster/glusterfs/3.5/3.5.1/Debian/apt wheezy main > /etc/apt/sources.list.d/gluster.list
# apt-get install glusterfs-server glusterfs-client -y
# update-rc.d glusterd defaults
# gluster --version

glusterfs 3.5.1 built on Jun 28 2014 04:14:49

Repository revision: git://git.gluster.com/glusterfs.git

Copyright (c) 2006-2011 Gluster Inc. <http://www.gluster.com>

GlusterFS comes with ABSOLUTELY NO WARRANTY.

You may redistribute copies of GlusterFS under the terms of the GNU General Public License.


Now it is mandatory that both machines must listen to each other with their hostname
   
# vi /etc/hossts

192.168.207.129         debian7n1
192.168.207.130         debian7n2

Now step : run this command gluster peer probe [hostname] in debian7n1 for connect both machine

# gluster peer probe devian7n2
peer probe: success

# gluster peer status

Number of Peers: 1

Hostname: debian7n2
Uuid: 58e8bbb2-6067-47b3-b1c7-1f2316d55013
State: Peer in Cluster (Connected)

Now I will create a common folder on both debian virtual machine at /data

# fdisk -l /dev/sd*
Disk /dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders, total 10485760 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/sdb doesn't contain a valid partition table 
# mkfs.ext3 /dev/sdb
mke2fs 1.42.5 (29-Jul-2012)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n)  y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 
# mkdir /data
#mount /dev/sdb /data

If you wish you can use any other mount points on both machines.
Now we need to create the volume where the data will reside. The volume will be called GlusterVol. Now run on any machine.
please follow this step on one machine:
# gluster volume create GlusterVol replica 2 transport tcp debian7n1:/data debian7n2:/data force
volume create: GlusterVol: success: please start the volume to access data

run this command to start volume

# gluster volume start GlusterVol volume start: GlusterVol: success # gluster volume info 
Volume Name: GlusterVol
Type: Replicate
Volume ID: 63bc4f7e-beb1-47b5-9cb9-9f111cb6b510
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: debian7n1:/data
Brick2: debian7n2:/data

No comments:

Post a Comment