Glusterfs is an open source Distributed file system that was bought by Red Hat in 2011. It has high scalability, high performance, high availability, scalable elasticity, no meta data server design makes Glusterfs no single point of trouble, For more information, please check the official website: www.gluster.org.
Deployment environment:
Os:centos Release 6.5 (Final) x64
Server:
c1:192.168.242.132
c2:192.168.242.133
c3:192.168.242.134
c4:192.168.242.135
Hosts
192.168.242.132 C1
192.168.242.133 C2
192.168.242.134 C3
192.168.242.135 C4
Specific actions:
The code is as follows |
Copy Code |
Execution on C1/C2/C3/C4 [Root@c1 ~]# wget-p/etc/yum.repos.d Http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo [Root@c1 yum.repos.d]# yum install-y glusterfs glusterfs-server [Root@c1 yum.repos.d]#/etc/init.d/glusterd start Starting glusterd: [OK] [Root@c1 yum.repos.d]# chkconfig Glusterd on |
Configuring clusters on C1
The code is as follows |
Copy Code |
[Root@c1 ~]# Gluster peer probe C1 Peer Probe:success. Probe on localhost not needed [Root@c1 ~]# Gluster peer probe C2 Peer Probe:success. [Root@c1 ~]# Gluster Peer probe C3 Peer Probe:success. [Root@c1 ~]# Gluster peer probe C4 Peer Probe:success. |
If C1 is recognized as an IP address in the peer table, there may be a communication problem in the following cluster process,
We can use IP to fix it:
The code is as follows |
Copy Code |
[Root@c3 ~]# Gluster Peer status Number of Peers:3 hostname:192.168.242.132 Uuid:6e8d6880-ec36-4331-a806-2e8fb4fda7be State:peer in Cluster (Connected) Hostname:c2 uuid:9a722f50-911e-4181-823d-572296640486 State:peer in Cluster (Connected) Hostname:c4 Uuid:1ee3588a-8a16-47ff-ba59-c0285a2a95bd State:peer in Cluster (Connected) [ROOT@C3 ~]# Gluster Peer Detach 192.168.242.132 Peer Detach:success [ROOT@C3 ~]# Gluster peer probe C1 Peer Probe:success. [Root@c3 ~]# Gluster Peer status Number of Peers:3 Hostname:c2 uuid:9a722f50-911e-4181-823d-572296640486 State:peer in Cluster (Connected) Hostname:c4 Uuid:1ee3588a-8a16-47ff-ba59-c0285a2a95bd State:peer in Cluster (Connected) Hostname:c1 Uuid:6e8d6880-ec36-4331-a806-2e8fb4fda7be State:peer in Cluster (Connected) |
Create cluster disks on C1
The code is as follows |
Copy Code |
[Root@c1 ~]# gluster Volume create datavolume1 Replica 2 transport TCP c1:/usr/local/share/datavolume1 C2:/usr/local/shar e/datavolume1 c3:/usr/local/share/datavolume1 c4:/usr/local/share/datavolume1 Force Volume Create:datavolume1:success:please start the volume to access data [Root@c1 ~]# gluster Volume create datavolume2 Replica 2 transport TCP C1:/usr/local/share/datavolume2 C2:/usr/local/shar E/datavolume2 c3:/usr/local/share/datavolume2 c4:/usr/local/share/datavolume2 Force Volume Create:datavolume2:success:please start the volume to access data [Root@c1 ~]# gluster Volume create Datavolume3 Replica 2 transport TCP C1:/usr/local/share/datavolume3 C2:/usr/local/shar E/datavolume3 C3:/usr/local/share/datavolume3 C4:/usr/local/share/datavolume3 Force Volume Create:datavolume3:success:please start the volume to access data [Root@c1 ~]# gluster Volume start datavolume1 Volume start:datavolume1:success [Root@c1 ~]# gluster Volume start datavolume2 Volume start:datavolume2:success [Root@c1 ~]# gluster Volume start Datavolume3 Volume start:datavolume3:success [ROOT@C1 ~]# Gluster Volume info Volume name:datavolume1 Type:distributed-replicate Volume id:819d3dc4-2a3a-4342-b49b-3b7961ef624f status:started Number of Bricks:2 x 2 = 4 Transport-type:tcp Bricks: Brick1:c1:/usr/local/share/datavolume1 Brick2:c2:/usr/local/share/datavolume1 Brick3:c3:/usr/local/share/datavolume1 Brick4:c4:/usr/local/share/datavolume1 Volume name:datavolume2 Type:distributed-replicate Volume ID:D9EBAEE7-EF91-4467-9E44-217A63635BFC status:started Number of Bricks:2 x 2 = 4 Transport-type:tcp Bricks: Brick1:c1:/usr/local/share/datavolume2 Brick2:c2:/usr/local/share/datavolume2 Brick3:c3:/usr/local/share/datavolume2 Brick4:c4:/usr/local/share/datavolume2 Volume Name:datavolume3 Type:distributed-replicate Volume ID:1E8B21DB-F377-468B-B76E-868EDDE93F15 status:started Number of Bricks:2 x 2 = 4 Transport-type:tcp Bricks: Brick1:c1:/usr/local/share/datavolume3 Brick2:c2:/usr/local/share/datavolume3 Brick3:c3:/usr/local/share/datavolume3 Brick4:c4:/usr/local/share/datavolume3 |
Client Environment Deployment
The code is as follows |
Copy Code |
Centos OS 6.5 x64 and join hosts [ROOT@C5 ~] #wget-P/ETC/YUM.REPOS.D Http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo [ROOT@C5 ~] #yum install-y glusterfs glusterfs-fuse [Root@c5 ~]# mkdir-p/mnt/{datavolume1,datavolume2,datavolume3} [Root@c5 ~]# mount-t glusterfs-o ro c1:datavolume1/mnt/datavolume1/ [Root@c5 ~]# mount-t glusterfs-o ro c1:datavolume2/mnt/datavolume2/ [Root@c5 ~]# mount-t glusterfs-o ro c1:datavolume3/mnt/datavolume3/ Me3 [Root@c5 ~]# Df-h FileSystem Size Used Avail use% mounted on /dev/mapper/volgroup-lv_root 38G 840M 36G 3%/ Tmpfs 242M 0 242M 0%/dev/shm /DEV/SDA1 485M 32M 429M 7%/boot C1:datavolume1 57G 2.4G 52G 5%/mnt/datavolume1 C1:datavolume2 57G 2.4G 52G 5%/mnt/datavolume2 C1:datavolume3 57G 2.4G 52G 5%/mnt/datavolume3 |