GlusterFS之故障节点更换

1.  目标

    原有的glusterfs集群,采用2*2的分布式复制卷

    现在有两个节点发生了硬盘故障,而且两个节点是同样的文件,所以造成了部分数据的丢失。

2.  恢复gluster集群

    1.  准备工作

        安装系统,安装gluster软件等。略

        172.16.1.98  node1

        172.16.1.99  node2

    2.  启动gluster软件

    3.  将原来的节点所包含的brick删除

        gluster volume remove-brick movie_rep_1 replica 2 node1:/gluster_data/vol_rep_1 node2:/gluster_data/vol_rep_1  force

    4.  将故障节点删除

        gluster peer detach node1 force                    

        gluster peer detach node2 force

    5.  将两个新节点加入集群

        gluster peer probe node1

        gluster peer probe node2

    6.  添加两个节点的brick

        gluster volume add-brick vol_rep_1 replica 2 node2:/gluster_data/vol_rep_1 node5:/gluster_data/vol_rep_1

    7.  查看该卷的信息

        gluster volume info vol_rep_1

Volume Name: vol_rep_1
Type: Distributed-Replicate
Volume ID: 294166af-db23-4253-963b-7f0e6b8898bf
Status: Started
Snapshot Count: 0
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: node3:/gluster_data/vol_rep_1
Brick2: node4:/gluster_data/vol_rep_1
Brick3: node2:/gluster_data/vol_rep_1
Brick4: node5:/gluster_data/vol_rep_1
Options Reconfigured:
nfs.disable: on
network.tcp-window-size: 1048576
performance.read-ahead: on
performance.cache-size: 512MB
performance.read-ahead-page-count: 4
performance.io-thread-count: 32
cluster.self-heal-daemon: enable
network.inode-lru-limit: 200000
performance.md-cache-timeout: 600
performance.cache-invalidation: on
performance.stat-prefetch: on
features.cache-invalidation-timeout: 600
features.cache-invalidation: on

    8.  查看数据恢复的状态

[root@node4 vol_rep_1]# gluster volume heal vol_rep_1 info
Brick node3:/gluster_data/vol_rep_1
Status: Connected
Number of entries: 0

Brick node4:/gluster_data/vol_rep_1
Status: Connected
Number of entries: 0

Brick node2:/gluster_data/vol_rep_1
Status: Connected
Number of entries: 0

Brick node1:/gluster_data/vol_rep_1
Status: Connected
Number of entries: 0

    9.  如果有数据没有同步,可以强制修复卷

        gluster volume heal vol_rep_1 full

 

    

          

    

        

posted @ 2024-10-23 17:54  奋斗史  阅读(93)  评论(0)    收藏  举报