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-27

はじめに

image.png

前提条件

  • 2台の ubuntu 22.04
  • Primary を node1、Secndary を node2 とする
  • Primary/Secondary 共に /dev/sda をシステム、/dev/sdb をストレージレプリケーションとして利用
  • node1 の IPアドレスは 192.168.100.101 とする
  • node2 の IPアドレスは 192.168.100.102 とする
  • マウント先は /export とする
  • すでに、/dev/drbd0 として構築済み

node1 を Primary に決定

  • node1 で
$ sudo drbdadm primary r0
$ sudo drbdadm status r0
$ sudo mount /dev/drbd0 /export

node1 を Primary -> Secondary 、 node2 を Secondary -> Primary

  • node1 で
$ sudo umount /export
$ sudo drbdadm secondary r0
$ sudo drbdadm status r0
  • node2 で
$ sudo drbdadm primary r0
$ sudo drbdadm status r0
$ sudo mount /dev/drbd0 /export

フォーマットしてみる

  • node1 が primary、node2 が secondary
  • 元のファイルシステムは xfs、変更先のファイルシステムは ext4
  • node1 で
$ sudo touch /export/aaa
$ ls /export
aaa
$ df -T
Filesystem                        Type  1K-blocks    Used Available Use% Mounted on
/dev/drbd0                        xfs    20960604  179192  20781412   1% /export
$ sudo umount /export
$ sudo mkfs.ext4 /dev/drbd0
mke2fs 1.46.5 (30-Dec-2021)
/dev/drbd0 contains a xfs file system
Proceed anyway? (y,N) y
Creating filesystem with 5242711 4k blocks and 1310720 inodes
Filesystem UUID: 09cefcc7-a853-49c2-ba03-e405fea00769
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done   

$ sudo mount /dev/drbd0 /export
$ df -T
Filesystem                        Type  1K-blocks    Used Available Use% Mounted on
/dev/drbd0                        ext4   20465580      24  19400632   1% /export
$ ls /export
lost+found
$ sudo touch /export/aaa
$ time sudo dd if=/dev/random of=/export/abcd bs=100M count=20
20+0 records in
20+0 records out
2097152000 bytes (2.1 GB, 2.0 GiB) copied, 10.678 s, 196 MB/s

real	0m10.688s
user	0m0.002s
sys	0m0.004s
$ md5sum /export/abcd
c5deb3807e7b3859afd2bb43558ec5f3  /export/abcd
$ ls /export
aaa  abcd  lost+found
$ sudo umount /export
$ sudo drbdadm secondary r0
  • node2 で
$ sudo drbdadm primary r0
$ sudo mount /dev/drbd0 /export
$ ls /export
aaa  abcd  lost+found
$ md5sum /export/abcd
c5deb3807e7b3859afd2bb43558ec5f3  /export/abcd

さいごに

  • かんたんでしたね

参考

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?