内容简介:本文风哥教程参考Linux官方文档、Red Hat Enterprise Linux官方文档、Ansible Automation Platform官方文档、Docker官方文档、Kubernetes官方文档和Podman官方文档等内容,详细介绍了相关技术的配置和使用方法。
风哥提示:
本文档介绍分布式存储系统的部署和配置方法。
Part01-GlusterFS部署
1.1 安装GlusterFS
[root@gluster1 ~]# dnf install -y centos-release-gluster9
[root@gluster1 ~]# dnf install -y glusterfs-server
# 启动GlusterFS
[root@gluster1 ~]# systemctl enable –now glusterd
# 配置防火墙
[root@gluster1 ~]# firewall-cmd –permanent –add-service=glusterfs
success
[root@gluster1 ~]# firewall-cmd –reload
success
# 添加节点到集群
[root@gluster1 ~]# gluster更多学习教程公众号风哥教程itpux_com peer probefrom PG视频:www.itpux.com gluster2.fgedu.net.cn
peer probe: success.
[root@gluster1 ~]# gluster peer probe gluster3.fgedu.net.cn
peer probe: success.
# 查看集群状态
[root@gluster1 ~]# gluster peer status
Number of Peers: 2
Hostname: gluster2.fgedu.net.cn
Uuid: 12345678-90ab-cdef-1234-567890abcdef
State: Peer in Cluster (Connected)
Hostname: gluster3.fgedu.net.cn
Uuid: 23456789-01ab-cdef-1234-567890abcdef
State: Peer in Cluster (Connected)
1.2 创建分布式卷
[root@gluster1 ~]# mkdir -p /data/glusterfs/brick1
# 创建分布式复制卷
[root@gluster1 ~]# gluster volume create gv0 replica 3 \
gluster1.fgedu.net.cn:/data/glusterfs/brick1 \
gluster2.fgedu.net.cn:/data/glusterfs/brick1 \
gluster3.fgedu.net.cn:/data/glusterfs/brick1
volume create: gv0: success: please start the volume to access data
# 启动卷
[root@gluster1 ~]# gluster volume start gv0
volume start: gv0: success
# 查看卷信息
[root@gluster1 ~]# gluster volume info gv0
Volume Name: gv0
Type: Replicate
Volume ID: 12345678-90ab-cdef-1234-567890abcdef
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 3 = 3
Transport-type: tcp
Bricks:
Brick1学习交流加群风哥QQ113257174: gluster1.fgedu.net.cn:/data/glusterfs/brick1
Brick2: gluster2.fgedu.net.cn:/data/glusterfs/brick1
Brick3: gluster3.fgedu.net.cn:/data/glusterfs/brick1
Options Reconfigured:
transport.address-family: inet
storage.fips-mode-rchecksum: on
nfs.disable: on
performance.client-io-threads: off
# 挂载卷
[root@client ~]# dnf install -y glusterfs-fuse
[root@client ~]# mkdir -p /mnt/glusterfs
[root@client ~]# mount -t glusterfs gluster1.fgedu.net.cn:/gv0 /mnt/glusterfs
# 验证挂载
[root@client ~]# df -h /mnt/glusterfs
Filesystem Size Used Avail Use% Mounted on
gluster1.fgedu.net.cn:/gv0 50G 1.0G 49G 2% /mnt/glusterfs
# 测试写入
[root@client ~]# dd if=/dev/zero of=/mnt/glusterfs/testfile bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 2.12345 s, 49.4 MB/s
[root@client ~]# ls -lh /mnt/glusterfs/
total 100M
-rw-r–r–. 1 root root 100M Apr 4 23:40:00 testfile
Part02-GlusterFS管理
2.1 卷管理操作
[root@gluster1 ~]# gluster volume add-brick gv0 replica 4 \
gluster4.fgedu.net.cn:/data/glusterfs/brick1
volume add-brick: success
# 重新均衡
[root@gluster1 ~]# gluster volume rebalance gv0 start
volume rebalance: gv0: success: Rebalance started
[root@gluster1 ~]# gluster volume rebalance gv0 status
Node Rebalanced-files size scanned failures skipped status run time in h:m:s
——— ———– ———– ———– ———– ———– ———— ————–
localhost 0 0Bytes 100 0 0 completed 0:00:01
# 设置配额
[root@gluster1 ~]# gluster volume quota gv0 enable
volume quota : success
[root@gluster1 ~]# gluster volume quota gv0 limit-usage / 10GB
volume quota : success
[root@gluster1 ~]# gluster volume quota gv0 list
Path Hard-limit Soft-limit Used Available Soft-limit exceeded? Hard-limit exceeded?
—————————————————————————————————————————
/ 10.0GB 8.0GB 0Bytes 10.更多视频教程www.fgedu.net.cn0GB No No
# 创建快照
[root@gluster1 ~]# gluster snapshot create snap1 gv0
snapshot create: success: Snap snap1 created successfully.
[root@gluster1 ~]# gluster snapshot list
snap1
# 恢复快照
[root@gluster1 ~]# gluster snapshot restore snap1
Snapshot restore: snap1: Snap restored successfully
# 卷性能调优
[root@gluster1 ~]# gluster volume set gv0 performance.cache-size 256MB
volume set: success
[root@gluster1 ~]# gluster volume set gv0 performance.io-thread-count 32
volume set: success
[root@gluster1 ~]# gluster volume set gv0 performance.write-behind-window-size 1MB
volume set: success
# 查看卷选项
[root@gluster1 ~]# gluster volume get gv0 all | grep performance
performance.cache-size 256MB
performance.io-thread-count 32
performance.write-behind-window-size 1MB
performance.cache-max-file-size 0
performance.cache-min-file-size 0
performance.cache-refresh-timeout 1
performance.quick-read on
performance.read-ahead on
- 使用复制卷保证数据安全
- 配置合理的副本数量
- 定期检查卷状态
- 设置配额防止空间耗尽
- 创建快照进行数据保护
本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html
