增加元数据节点

目前的元数据节点状态:

> beegfs-ctl --listnodes --nodetype=meta --nicdetails
beegfs-node1 [ID: 1]
   Ports: UDP: 8005; TCP: 8005
   Interfaces:
   + eth0[ip addr: 172.17.0.2; type: TCP]
beegfs-node2 [ID: 2]
   Ports: UDP: 8005; TCP: 8005
   Interfaces:
   + eth0[ip addr: 172.17.0.5; type: TCP]

Number of nodes: 2
Root: 1

目前的元数据存储 buddy mirror

> beegfs-ctl --listmirrorgroups --nodetype=meta
     BuddyGroupID     PrimaryNodeID   SecondaryNodeID
     ============     =============   ===============
                1                 2                 1

目前的元数据存储 buddy mirror 状态

> beegfs-ctl --listtargets --nodetype=meta --state
TargetID     Reachability  Consistency   NodeID
========     ============  ===========   ======
       1           Online         Good        1
       2           Online         Good        2

查看创建前的元数据存储剩余大小

# beegfs-node1
> df /beegfs/meta/
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/vdb1       15267040 264284  13938524   2% /beegfs/meta

# beegfs-node2
> df /beegfs/meta/
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/vdb1       15267040 264276  13938532   2% /beegfs/meta

使用如下命令先模拟一些数据到已有的节点

#!/usr/bin/env bash

base_dir=/mnt/beegfs/test1

for i in $(seq 1 1000000)
do
    uuid=$(uuidgen)
    dir_name="${base_dir}/${uuid:0:1}/${uuid:1:2}/${uuid}"
    mkdir -p "${dir_name}"
    echo "aa" > "${dir_name}/content"
done

查看写入文件后的元数据存储剩余大小

# beegfs-node1
> df /beegfs/meta/
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/vdb1       15267040 522124  13680684   4% /beegfs/meta

# beegfs-node2
> df /beegfs/meta/
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/vdb1       15267040 522116  13680692   4% /beegfs/meta

增加节点前,关闭所有的 storage 和 client

systemctl stop beegfs-client
systemctl stop beegfs-helperd
systemctl stop beegfs-storage

确定客户端状态

确定存储服务器状态

> beegfs-check-servers
Management
==========
beegfs-node1 [ID: 1]: reachable at 172.17.0.2:8008 (protocol: TCP)

Metadata
==========
beegfs-node1 [ID: 1]: reachable at 172.17.0.2:8005 (protocol: TCP)
beegfs-node2 [ID: 2]: reachable at 172.17.0.5:8005 (protocol: TCP)

Storage
==========
beegfs-node1 [ID: 11]: UNREACHABLE
beegfs-node2 [ID: 12]: UNREACHABLE
beegfs-node3 [ID: 13]: UNREACHABLE
beegfs-node4 [ID: 14]: UNREACHABLE

在新的节点中设置 meta

  • 磁盘初始化
  • 挂载磁盘
  • 初始化 meta 存储
  • 启动 meta 服务

自动创建元数据 Group

> beegfs-ctl --addmirrorgroup --automatic --nodetype=meta

Existing mirror groups:
BuddyGroupID   Node type Node
============   ========= ====
           1     primary        2 @ beegfs-meta beegfs-node2 [ID: 2]
               secondary        1 @ beegfs-meta beegfs-node1 [ID: 1]

New mirror groups:
BuddyGroupID   Node type Node
============   ========= ====
           2     primary        3 @ beegfs-meta beegfs-node3 [ID: 3]
               secondary        4 @ beegfs-meta beegfs-node4 [ID: 4]

Mirror buddy group successfully set: groupID 2 -> target IDs 3, 4

激活 metadata mirroring,需要重启所有的 meta service,参考:https://www.beegfs.io/wiki/MDMirror#hn_59ca4f8bbb_2

> beegfs-ctl --mirrormd
Meta mirroring is already enabled

重启所有 beegfs-meta 服务

systemctl restart beegfs-meta

分别启动 storage 和 client( after helperd)

查看 meta mirror 分组

beegfs-ctl --listmirrorgroups --nodetype=meta
     BuddyGroupID     PrimaryNodeID   SecondaryNodeID
     ============     =============   ===============
                1                 2                 1
                2                 3                 4

记录初始 inode 数量

# beegfs-node1
> df /beegfs/meta/
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/vdb1       15267040 522124  13680684   4% /beegfs/meta

# beegfs-node2
> df /beegfs/meta/
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/vdb1       15267040 522116  13680692   4% /beegfs/meta

# beegfs-node3
> df /beegfs/meta/
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/vdb1       15267040 264276  13938532   2% /beegfs/meta

# beegfs-node4
> df /beegfs/meta/
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/vdb1       15267040 264276  13938532   2% /beegfs/meta

配置文件,优先写入新的 meta

# /etc/beegfs/beegfs-client.conf
tunePreferredMetaFile = /etc/beegfs/beegfs-client-tunePreferredMetaFile

# [tunePreferredMetaFile], [tunePreferredStorageFile]
# Path to a text file that contains the numeric IDs of preferred storage targets
# and metadata servers. These will be preferred when the client creates new file
# system entries. This is useful e.g. to take advantage of data locality in the
# case of multiple data centers. If unspecified, all available targets and
# servers will be used equally.
# Usage: One targetID per line for storage servers, one nodeID per line for
#    metadata servers.
# Note: TargetIDs and nodeIDs can be queried with the beegfs-ctl tool.
# Default: <none>

此处选择 meta 3 / 4 节点

3
4

标记旧节点不可用

echo 0 > /beegfs/meta/free_space.override

重启 client

systemctl restart beegfs-helperd
systemctl restart beegfs-client

使用如下命令先模拟一些数据到已有的节点

#!/usr/bin/env bash

base_dir=/mnt/beegfs/test1

for i in $(seq 1 1000)
do
    uuid=$(uuidgen)
    dir_name="${base_dir}/${uuid:0:1}/${uuid:1:2}/${uuid}"
    mkdir -p "${dir_name}"
    echo "aa" > "${dir_name}/content"
done

执行写入文件后,查看 inode 数量,可发现旧的节点不再写入,新的节点存储数据

读取原 1 和 2 节点中的数据,发现仍为可用