Glusterfs
is a clustered file system that can be scaled to several petabytes of magnitude. It can converge several different types of storage blocks into a large parallel network file system via InfiniBand RDMA or TCP/IP.
One, volume management
The transport protocol for the data supports the TCP and InfiniBand RDMA protocols.
1, three types of volumes:
(1) Distributed volume
A distributed volume can store a file randomly in a brick within a volume, typically for extended storage capabilities, and does not support data redundancy. Unless the underlying brick uses external redundancy measures such as raid.
Gluster Volume Create Mamm-volume node1:/media node2:/media node3:/media ...
(2) Replicated volume
The replica volume can specify the number of replicas when it is created, and the replicas are stored on different brick of the volume, so a few replicas must provide at least multiple brick.
Gluster Volume Create Mamm-volume repl 2 Node1:/media Node2:/media
Attention:
When you create a replica volume, the number of brick must be equal to the replica number, otherwise an error will be made.
In addition, if the same node provides multiple brick, you can also create replica volumes on the same nodes, but this is not safe because a device is hung up and all the brick on it cannot be accessed
(3) Striped volume
A fragmented volume divides a single file into small chunks (block size support configuration, defaults to 128K), and then stores the small blocks on different brick to improve file access performance.
Gluster volume Create Mamm-volume stripe 2 Node1:/media Node2:/media
The parameters after stripe indicate the number of distribution positions of the slices
Attention:
The number of brick must be equal to the number of distribution locations
2, extension types such as:
Distribute Replication volume
This type of volume is an extension of the base replica volume, and you can specify several brick to form one replica volume, and several brick to form another replica volume. A single file remains replicated within the replica volume, and different files are distributed between different replica volumes
Gluster Volume Create Dr-volume repl 2 node1:/exp1 node2:/exp2 node3:/exp3 node4:/exp4node5:/exp5 node6:/exp6
Attention:
The composition of the replica volume depends on the order of the specified brick, the same as 1, 2 the same 3, 4 the same as 5, 6 the same
The brick must be n times the number of replicas K, and the brick list will be set in groups of K, forming n replica volumes
Second, service-side configuration
1, installation
Wget-p/etc/yum.repos.d/http://download.gluster.org/pub/gluster/glusterfs/latest/centos/glusterfs-epel.repo
Yum Install Glusterfs-server
/etc/init.d/glusterd start
2, adding nodes
Gluster peer probe 192.168.222.134#添加设备到存储池
Gluster Peer probe 192.168.222.135
Gluster Peer status#查看除本机外的其他设备状态
Gluster Peer Detach 192.168.222.134#将某设备从存储池中删除
3, create the volume
Gluster Volume Create gfs01 repl 2 192.168.222.134:/opt/gfs 192.168.222.135:/opt/gfs
Gluster Volume Info View volume information.
Gluster Volume status to view the status of the volume.
4, start/stop/delete volume
Gluster Volume Sart gfs01
Gluster Volume Stop Gfs01
Gluster Volume Delete gfs01
5, Access control
Gluster Volume set glfs01 auth.allow 192.168.222.1,192.168.*.*
6, Expansion/shrink Volume
New Add Volume
Gluster volume Add-brick gfs01 repl 2 192.168.222.134:/OPT/GLUSFS 192.168.222.135:/OPT/GLUSFS Force
Delete a volume
Gluster volume Remove-brick gfs01 repl 2 192.168.222.134:/opt/gfs 192.168.222.135:/opt/gfs start
Gluster volume Remove-brick gfs01 repl 2 192.168.222.134:/opt/gfs 192.168.222.135:/opt/gfs status
Gluster volume Remove-brick gfs01 repl 2 192.168.222.134:/opt/gfs 192.168.222.135:/opt/gfs Commit
Note: When expanding or shrinking a volume, the number of brick to be added to or reduced by the type of volume must meet the corresponding requirements.
After the volume has been expanded or shrunk, the volume's data needs to be re-balanced.
Gluster Volume rebalance Mamm-volume start|stop|status
7, migrating volumes
Primary completion of online migration of data between volumes
Gluster volume Replace-brick gfs01 192.168.222.134:/opt/gfs 192.168.222.134:/opt/test start Force#启动迁移过程
Gluster volume Replace-brick gfs01 192.168.222.134:/opt/gfs 192.168.222.134:/opt/test status#查看迁移状态
Gluster volume Replace-brick gfs01 192.168.222.134:/opt/gfs 192.168.222.134:/opt/test commit #迁移完成后提交完成
8, trigger copy self-healing
Gluster Volume heal Mamm-volume #只修复有问题的文件
Gluster Volume heal Mamm-volume full #修复所有文件
Gluster Volume Heal Mamm-volume info#查看自愈详情
Three, client Configuration
1, installation
#yum-y Install glusterfs glusterfs-fuse
2, Mount
#mkdir/mnt/gfs
#mount-T Glusterfs 192.168.222.135:/gfs01/mnt/gfs
3. Join the boot or/etc/rc.local
#vim/etc/fstab
192.168.222.135:/glfs01/mnt/glfsglusterfsdefault,_netdev00
This article is from the "Linuxdream" blog, make sure to keep this source http://books.blog.51cto.com/2600359/1643969
Glusterfs Cluster System Configuration