复制卷
多个文件在多个brick上复制多份,brick 的数目要与需要复制的份数相等,建议brick分布在不同的服务器上。
复制卷和条带卷必须要指定卷的类型,复制卷就是每一个brick中的数据都是一样的,都是写入数据的完整备份。
所以容量会减少一半,当然性能上也会有所消耗.
应用场景: 对可靠性和读性能要求高的场景
优点: 读性能好
缺点: 写性能差</pre>
[root@node4 ~]# gluster
Welcome to gluster prompt, type 'help' to see the available commands.
创建复制卷
gluster> volume create datavol2 replica 2 transport tcp node1:/data0/gluster/data2 node2:/data0/gluster/data2 force #创建卷
volume create: datavol2: success: please start the volume to access data
启动volume
gluster> volume start datavol2
volume start: datavol2: success
查看volume状态
gluster> volume status datavol2
Status of volume: datavol2
Gluster process TCP Port RDMA Port Online Pid
------------------------------------------------------------------------------
Brick node1:/data0/gluster/data2 49153 0 Y 11961
Brick node2:/data0/gluster/data2 49153 0 Y 11858
Self-heal Daemon on localhost N/A N/A Y 12031
Self-heal Daemon on node3 N/A N/A Y 11857
Self-heal Daemon on node2 N/A N/A Y 11879
Self-heal Daemon on node1 N/A N/A Y 11982
Task Status of Volume datavol2
------------------------------------------------------------------------------
There are no active volume tasks
查看卷信息
gluster> volume info datavol2
Volume Name: datavol2
Type: Replicate
Volume ID: cb872ec7-6ce0-4635-bea2-d2e8d08dfac5
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: node1:/data0/gluster/data2
Brick2: node2:/data0/gluster/data2
Options Reconfigured:
transport.address-family: inet
storage.fips-mode-rchecksum: on
nfs.disable: on
performance.client-io-threads: off</pre>
<pre spellcheck="false" class="md-fences md-end-block md-fences-with-lineno ty-contain-cm modeLoaded" lang="shell" cid="n31" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px 0px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"> 想要看到需要挂载
关于数据,存储节点会同步控制节点的数据,控制节点不会同步存储节点的数据
[root@node3 ~]# mount -t glusterfs node1:/datavol2/ /mnt
[root@node3 ~]# ls /mnt/
[root@node3 ~]# cd /mnt/
[root@node3 mnt]# touch a.txt #创建测试数据
测试
[root@node1 ~]# ls /data0/gluster/data2/
a.txt
[root@node2 ~]# ls /data0/gluster/data2
a.txt
条带卷
不支持了
将文件分成条带,存放在多个 brick上,默认条带大小128K
条带卷在处理大文件的时候会有一定的作用,它会将文件拆分几个部分,分别存在两个条带上即两个brick上。这个实际用的较少
应用场景: 大文件
优点: 适用于大文件存储
缺点: 可靠性低,brick 故障会导致数据全部丢失
创建条带卷
gluster> volume create datavol3 stripe 2 node01:/data0/gluster/data3 node02:/data0/gluster/data3 force
stripe option not supported