0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【2023年05月版】Ubuntu22.04 上での DRBD によるストレージレプリケーション デバイス追加編

Last updated at Posted at 2023-05-30

はじめに

  • DRBDで対象デバイスを追加したい・・・

image.png

まとめはこちら

【2023年05月版】Ubuntu22.04 上での DRBD によるストレージレプリケーション

前提条件

  • 2台の ubuntu 22.04
  • Primary を node1、Secndary を node2 とする
  • Primary/Secondary 共に /dev/sda をシステム、/dev/sdb をストレージレプリケーションとして利用
  • 今回は、/dev/sdc を追加
  • node1 の IPアドレスは 192.168.100.101 とする
  • node2 の IPアドレスは 192.168.100.102 とする
  • 既存デバイスは、/dev/drbd0 とする
  • 追加デバイスは、/dev/drbd1 とする
  • 既存のマウント先は /export とする
  • 追加のマウント先は /export2 とする

手順

  • DRBD の停止
  • 設定の追加
  • 設定の読み込み
  • DRBD の停止
  • メタデータの作成
  • DRBD の開始
  • Primary の決定 〜 自動的に同期

DRBD の停止

  • Primary/Secondary 共に
$ sudo drbdadm down r0
$ sudo drbdadm status r0

既存の設定ファイル

/etc/drbd.d/global_common.conf
global {
    usage-count no;
}
common {
    net {
        protocol C;
    }
}
/etc/drbd.d/r0.res
resource r0 {
    device /dev/drbd0;
    disk /dev/sdb;
    meta-disk internal;
    on node1 {
        address 192.168.100.101:7789;
    }
    on node2 {
        address 192.168.100.102:7799;
    }
}

デバイス追加の設定ファイル

  • volume 記述が増えていることに注意
/etc/drbd.d/r0.res
resource r0 {
    volume 0 {
      device /dev/drbd0;
      disk /dev/sdb;
      meta-disk internal;
    }
    volume 1 {
      device /dev/drbd1;
      disk /dev/sdc;
      meta-disk internal;
    }
    on node1 {
        address 192.168.100.101:7789;
    }
    on node2 {
        address 192.168.100.102:7799;
    }
}

DRBD の設定ファイル変更の読み込み

  • Primary/Secondary 共に
$ sudo drbdadm adjust r0

DRBD の停止

  • Primary/Secondary 共に
$ sudo drbdadm down r0
$ sudo drbdadm status r0

追加デバイスのメタデータの作成

  • Primary/Secondary 共に
  • r0/1 は今回追加したデバイス
$ sudo drbdadm create-md r0/1

DRBD の起動

  • Primary/Secondary 共に
$ sudo drbdadm up r0
$ sudo drbdadm status r0

Primary 決定

  • Primary だけで
$ sudo drbdadm primary r0
$ sudo drbdadm status r0
$ sudo mount /dev/drbd0 /export
$ sudo mount /dev/drbd1 /export2

さいごに

  • かんたんでしたね

参考

Ubuntu 22.04 man page drbdadm
Ubuntu 22.04 man page drbd

DRBD9 ユーザーズガイド
LINSTOR ユーザーズガイド

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?