gluster使用——9种创建方法

gluster学习:
gluster把多个brick组成一个volume。根据所要组成的volume的存储方式不同,可以分为几种不同的组成方式:

1.Distributed:分布式的,一个文件随机存储在一个的brick上,文件不能拆分。此时volume的容量是所有brick的和,没有冗余盘。默认是分布式的。
创建一个Distributed:
gluster volume create new 192.168.1.152:/mnt/f1/s1 192.168.152:/mnt/f2/a2

2.Replicated:1:1备份式,一个文件会同时存储在两个brick上,一个是存储一个是备份。所以此时volume得到的容量应该是所有brick容量和的1/2。
#创建一个镜像式的volume
gluster volume create new2 replica 2  192.168.1.152:/mnt/f3/s3  192.168.1.152:/mnt/f4/s4 force

3.Striped:条带式,把一个文件按照一定的算法分开存储在好几个brick上。比如:对于一个文件,奇数行存储在第一个brick上,偶数行存储在第二个brick。(仅在高并发环境中访问非常大的文件时才使用)
#条带式创建,失败。提示:Wrong brick type: 2, use <HOSTNAME>:<export-dir-abs-path>
 gluster volume create stripe 2 transport tcp 192.168.1.152:/mnt/f1/s1 192.168.1.152:/mnt/f2/s2
此处没有写名字,需要在create后面加上名字。
 gluster volume create new4 stripe 2 transport tcp 192.168.1.152:/mnt/f1/s1 192.168.1.152:/mnt/f2/s2

4.Distributed Striped:分布条带式,一个文件先按照分布式的方式(文件数据没有被拆散)存放在一个大brick中,在这个大brick中,再用条带式的方式(文件数据被分散存放)存放在4个小的brick中。
#新建分布条带式
 gluster volume create new stripe 4 192.168.1.130:/mnt/f1/s1 192.168.1.130:/mnt/f2/s2 192.168.1.130:/mnt/f3/s3 192.168.1.130:/mnt/f4/s4 192.168.1.130:/mnt/f5/s5 192.168.1.130:/mnt/f6/s6 192.168.1.130:/mnt/f7/s7 192.168.1.130:/mnt/f8/s8
注意:stripe后面跟的数字是4,一共有8个brick

5.Distributed Replicated:分布式副本卷,一个文件先按照分布式(文件数据没有被拆散)存放在一个大Brick中,然后又按照镜像式(文件数据没有被拆散,有一个副本)存放在小的brick中。
 gluster volume create test-volume replica 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4
 注意:replica后面跟的数字是2,一共有4个brick

6.Distributed Striped Replicated:分布式条带式复制式,先分布式,然后条带式,再镜像式
 gluster volume create test-volume stripe 2 replica 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4 server5:/exp5 server6:/exp6 server7:/exp7 server8:/exp8
 注意:一共8个brick,stripe后面跟2,表示一个文件被分散在两个文件中存储。replica后面跟的是2

7.Striped Replicated:条带式副本式,File文件被打撒存放在server1和server2中,server3和servere4中的数据是server1和server2数据的一个备份
 gluster volume create test-volume stripe 2 replica 2 transport tcp server1:/exp1 server2:/exp2 server3:/exp3 server4:/exp4
 只需要在创建的时候规定条带式和镜像式的个数就可以了,brick的总量必须是条带式*镜像式的倍数

8.Dispersed:分散式(冗余式),例如,数据保存在10个brick中,每个brick有1T,10个brick中有3个是作为冗余brick,作为数据校验,不做存储。此时volume只有7T,volume中允许有3个brick损坏
#分散式需要指定冗余的数量和分散卷的数量来指定。
冗余必须大于0,并且brick的总数必须大于2*冗余,则意味着分散卷必须有三个brick
gluster volume create new disperse 3 redundancy 1 192.168.1.130:/mnt/f1/s1 192.168.1.130:/mnt/f2/s2 192.168.1.130:/mnt/f3/s3 force

gluster volume create dis disperse 9 redundancy 3 192.168.1.132:/mnt/f1/s1 192.168.1.132:/mnt/f2/s2 192.168.1.132:/mnt/f3/s3 192.168.1.133:/mnt/f1/s1 192.168.1.133:/mnt/f2/s2 192.168.1.133:/mnt/f3/s3 192.168.1.134:/mnt/f1/s1 192.168.1.134:/mnt/f2/s2 192.168.1.134:/mnt/f3/s3 force

9.Distributed Dispersed:分布式分散卷,效果等同于分布式复制卷,只不过子卷是使用分散式而不是复制式
gluster volume create disperse <count> [redundancy <count>] [transport tcp | rdma | tcp,rdma]
注意:disperse 后面跟的数值是整个分散的brick数量,包括冗余在内了。redundancy后面跟的数量是指在disperse给定情况下要设置几个冗余盘。server给出的brick数量要是disperse的整数倍
当冗余盘的数量是Dispersed的1/2时,整个系统就是镜像式的了。冗余盘的数量不能够大于Dispersed得1/2

猜你喜欢

转载自blog.csdn.net/u012282330/article/details/80893104