Gluster File System is a distributed files system allowing you to create a single volume of storage which spans multiple disks,
multiple machines and even multiple data centres.Install the required packages using apt-get on both Ubuntu machines.
If you have more than two servers, perform this command on all of the servers required for the volume.
Run the below command in all the servers which all are part of the glusterfs:
#apt-get install glusterfs-server
After successful installation, open the terminal and type following command and check if the installation was successful:
#glusterfs –version
Glusterfs version should be equal in all the systems.
# gluster –version glusterfs 3.2.5 built on Jan 31 2012 07:39:59 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.
Put Local host entry to reach each system with names
#vim /etc/hosts
10.10.100.226 adeoqa.payoda.com gluster1 10.10.100.227 wordpress.payoda.com gluster2
Now from Gluster Server 1 (adeoqa.payoda.com), probe the second server.
#gluster peer probe wordpress.payoda.com
The output should like below.
peer probe: success
Now I will check the status for peer as:
#gluster peer status
Output: from server 1
Number of Peers: 1 Hostname: wordpress.payoda.com Uuid: 96e14ba6-d8fd-4898-be55-c3f962f4c1f4 State: Peer in Cluster (Connected)
Create a directory, which will act as mount point.
mkdir -p /datarep
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 datapoint. Now run on any machine:
#gluster volume create test-volume replica 2 transport tcp adeoqa.payoda.com:/datarep wordpress.payoda.com:/datarep
volume create: test-volume: success: please start the volume to access data
Now we need to start the volume:
#gluster volume start test-volume
Running either of the below commands should indicate that GlusterFS is up and running. The ps command should show the command running with both servers in the argument. netstat should show a connection between both nodes.
#ps aux | grep gluster
#netstat -tap | grep glusterfsd
As a final test, to make sure the volume is available, run gluster volume info. As shown below:
#gluster volume info
Output will be like below.
Volume Name: testvol Type: Distribute Status: Started Number of Bricks: 2 Transport-type: tcp Bricks: Brick1: adeoqa.payoda.com:/data Brick2: wordpress.payoda.com:/data Volume Name: test-volume Type: Replicate Status: Started Number of Bricks: 2 Transport-type: tcp Bricks: Brick1: adeoqa.payoda.com:/datarep Brick2: wordpress.payoda.com:/datarep
To test Glusterfs, we would need to mount the volume in a mount point
#mount -t glusterfs adeoqa.payoda.com:/test-volume /var/www/drupalldap/sites/default/files/resume/
Here adeoqa.payoda.com is gluster1 server, /test-volume is volume name, /var/www/drupalldap/sites/default/files/resume/ is mount point.
now try df -h to check the mounted drives.
To test replication, create a file in one server in mounted path, will be displayed in the second server also.
No comments:
Post a Comment