GlusterFS分布式存储系统中更换故障Brick的操作记录1
前面已经介绍了GlusterFS分布式存储集群环境部署记录,现在模拟下更换故障Brick的操作:
1)GlusterFS集群系统一共有4个节点,集群信息如下:
分别在各个节点上配置hosts、同步好系统时间,关闭防火墙和selinux
[root@GlusterFS-slave data]# cat /etc/hosts
192.168.10.239 GlusterFS-master
192.168.10.212 GlusterFS-slave
192.168.10.204 GlusterFS-slave2
192.168.10.220 GlusterFS-slave3
分别在各个节点上创建存储目录
首先新建分区
# fdisk /dev/sdb //依次输入p->n->1->回车->回车->w
发现并校验
# partx /dev/sdb
# ls /dev/sdb*
创建文件系统
# mkfs.xfs -i size=1024 /dev/sdb1
配置挂载
# mkdir -p /data
# echo '/dev/sdb1 /data xfs defaults 1 2' >> /etc/fstab
# mount -a && mount
配置存储位置
# mkdir /data/gluster
部署glusterfs集群的中间部分操作在此省略,具体可参考:http://www.cnblogs.com/kevingrace/p/8743812.html
[root@GlusterFS-master ~]# gluster peer status
Number of Peers: 3
Hostname: 192.168.10.212
Uuid: f8e69297-4690-488e-b765-c1c404810d6a
State: Peer in Cluster (Connected)
Hostname: 192.168.10.204
Uuid: a989394c-f64a-40c3-8bc5-820f623952c4
State: Peer in Cluster (Connected)
Hostname: 192.168.10.220
Uuid: dd99743a-285b-4aed-b3d6-e860f9efd965
State: Peer in Cluster (Connected)
[root@GlusterFS-master ~]# gluster volume info
Volume Name: models
Type: Distributed-Replicate
Volume ID: f1945b0b-67d6-4202-9198-639244ab0a6a
Status: Started
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: 192.168.10.239:/data/gluster
Brick2: 192.168.10.212:/data/gluster
Brick3: 192.168.10.204:/data/gluster
Brick4: 192.168.10.220:/data/gluster
Options Reconfigured:
auth.allow: 192.168.*
performance.write-behind: on
performance.io-thread-count: 32
performance.flush-behind: on
performance.cache-size: 128MB
features.quota: on
客户端挂载GlusterFS存储
[root@Client ~]# mount -t glusterfs 192.168.10.239:models /data/gluster/
2)测试Gluster卷
写入测试数据
[root@Client ~]# for i in `seq -w 1 100`; do cp -rp /var/log/messages /opt/gfsmount/copy-test-$i; done
写入确认
[root@Client ~]# ls -lA /opt/gfsmount|wc -l
101
在各节点机器上也确认下,发现这100个文件随机地各自分为了两个50份的文件(均衡),分别同步到了第1-2节点和第3-4节点上了。
[root@GlusterFS-master ~]# ll /opt/gluster/data/|wc -l
51
[root@GlusterFS-master ~]# ls /opt/gluster/data/
copy-test-001 copy-test-016 copy-test-028 copy-test-038 copy-test-054 copy-test-078 copy-test-088 copy-test-100
copy-test-004 copy-test-017 copy-test-029 copy-test-039 copy-test-057 copy-test-079 copy-test-090
copy-test-006 copy-test-019 copy-test-030 copy-test-041 copy-test-060 copy-test-081 copy-test-093
copy-test-008 copy-test-021 copy-test-031 copy-test-046 copy-test-063 copy-test-082 copy-test-094
copy-test-011 copy-test-022 copy-test-032 copy-test-048 copy-test-065 copy-test-083 copy-test-095
copy-test-012 copy-test-023 copy-test-033 copy-test-051 copy-test-073 copy-test-086 copy-test-098
copy-test-015 copy-test-024 copy-test-034 copy-test-052 copy-test-077 copy-test-087 copy-test-099
[root@GlusterFS-slave ~]# ll /opt/gluster/data/|wc -l
51
[root@GlusterFS-slave ~]# ls /opt/gluster/data/
copy-test-001 copy-test-016 copy-test-028 copy-test-038 copy-test-054 copy-test-078 copy-test-088 copy-test-100
copy-test-004 copy-test-017 copy-test-029 copy-test-039 copy-test-057 copy-test-079 copy-test-090
copy-test-006 copy-test-019 copy-test-030 copy-test-041 copy-test-060 copy-test-081 copy-test-093
copy-test-008 copy-test-021 copy-test-031 copy-test-046 copy-test-063 copy-test-082 copy-test-094
copy-test-011 copy-test-022 copy-test-032 copy-test-048 copy-test-065 copy-test-083 copy-test-095
copy