Glusterfs is mainly used in cluster system and has good scalability. The structure of the software is good, easy to expand and configure, through the flexible collocation of each module to get targeted solutions. Resolves the following issues: networked storage, federated storage (fusing storage space on multiple nodes), redundant backups, load balancing of large files (chunking).
Due to the lack of some key features, reliability has not been tested for a long time, it is not suitable for the need to provide 24-hour uninterrupted service product environment. Currently suitable for the use of large data offline applications, let's look at the Glusterfs Distributed File system installation configuration
Glusterfs is an open source Distributed file system where users can use multiple servers and interconnect via Ethernet or InfiniBand RDMA to form a glusterfs cluster
。
The Glusterfs cluster provides interfaces for Nfs,cifs and Gluster Native (mounted via fuse) for users to access glusterfs storage pools.
Glusterfs uses an elastic hashing algorithm to locate the location of the file store. Because the resilient hashing algorithm is used, Glusterfs does not require a dedicated Meta-data server to hold the metadata, thus avoiding the entire cluster being unavailable due to a meta-data server outage.
It is precisely because the metadata server does not need, so glusterfs in multiple mount points at the same time to read and write data, its overall performance is very prominent.
Fuse-2.9.3.tar.gz #依赖于fuse
Glusterfs-3.6.0.tar.gz #本文用的版本
Prepare 2 machines, the system is centos6.5 64 bits.
IP Address host Name
192.168.0.107 G1
192.168.0.136 G2
First off iptables and SELinux.
Modify the host name and add the hosts map:
G1:
[Root@localhost ~]# Cat/etc/sysconfig/network
Networking=yes
Hostname=g1
[Root@localhost ~]# hostname
G1
[Root@localhost ~]# cat/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.107 G1
192.168.0.136 G2
G2:
[Root@localhost ~]# Cat/etc/sysconfig/network
Networking=yes
Hostname=g2
[Root@localhost ~]# hostname
G2
[Root@localhost ~]# cat/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.107 G1
192.168.0.136 G2
To install a precompiled environment:
[Root@localhost ~]# yum install-y gcc gcc-c++ flex flex-devel bison bison-devel OpenSSL openssl-devel libxml2 Libxml2-dev El
Install Fuse:
[Root@localhost ~]# CD fuse-2.9.3
[Root@localhost fuse-2.9.3]#./configure && make && make install
[Root@localhost fuse-2.9.3]# CD
Install Gluster:
[Root@localhost ~]# CD glusterfs-3.6.0
[Root@localhost glusterfs-3.6.0]#./configure--prefix=/usr/local/glusterfs && make && make install
Both G1 and G2 perform the above operation.
G1 and G2 start Gluster:
[root@localhost ~]# Service Glusterd start
To add a cluster:
[Root@localhost ~]# ln-s/usr/local/glusterfs/sbin/gluster/usr/bin/gluster #做一个软链接方便执行命令
[Root@localhost ~]# Gluster peer probe G2 #在g1中将g2加入到gluster集群中, this machine (G1) does not need to be joined.
Peer Probe:success. Probe on localhost not needed
To view cluster information:
[Root@localhost ~]# Gluster Peer status
Number of Peers:1
Hostname:g2
Uuid:c7aa664a-3161-4716-9f81-2dc4b4718fa1
State:peer in Cluster (Connected) #已连接
Remove machine:
[Root@localhost ~]# Gluster Peer detach G2
Peer Detach:success
To create a volume:
[Root@localhost ~]# gluster Volume create Test-volume Replica 2 transport TCP G1:/data G2:/data force
Volume Create:test-volume:success:please start the volume to access data
Test-volume volume name replica replica number transport transport Protocol G1:/data server name and storage path
Boot Volume:
[Root@localhost ~]# gluster Volume start Test-volume
Volume start:test-volume:success
To view volumes:
[Root@localhost ~]# Gluster Volume info
Volume Name:test-volume
Type:replicate
Volume ID:104D73C5-17F5-4150-A40D-B97CD78DD6BB
status:started
Number of bricks:1 x 2 = 2
Transport-type:tcp
Bricks:
Brick1:g1:/data
Brick2:g2:/data
Client 1 mount (also installs fuse and glusterfs to support Glusterfs file system):
[Root@localhost ~]# Mkdir/mnt/gfs
[Root@localhost ~]# mount-t glusterfs g1:test-volume/mnt/gfs/
[Root@localhost ~]# Df-h
FileSystem Size Used Avail use% mounted on
/DEV/SDA1 77G 3.7G 70G 6%/
Tmpfs 499M 0 499M 0%/dev/shm
G1:test-volume 77G 3.8G 70G 6%/mnt/gfs
Client 2 Mount:
[Root@localhost ~]# Mkdir/mnt/gfs
[Root@localhost ~]# mount-t glusterfs G2:test-volume/mnt/gfs
[Root@localhost ~]# Df-h
FileSystem Size Used Avail use% mounted on
/DEV/SDA1 77G 3.8G 70G 6%/
Tmpfs 499M 0 499M 0%/dev/shm
G2:test-volume 77G 3.8G 70G 6%/mnt/gfs
You can see that both G1 and G2 support mounting.
Gluster Supported parameters
[Root@localhost ~]# Gluster help #查看参数
The installation configuration is complete.