LINBIT / drbd

LINBIT DRBD kernel module
https://docs.linbit.com/docs/users-guide-9.0/
GNU General Public License v2.0
587 stars 100 forks source link

when reboot Primary node, it wil become Secondary #97

Closed willzhang closed 3 months ago

willzhang commented 3 months ago

Why when i reboot Primary node, it wil become Secondary.

root@node51:~# drbdadm --version
DRBDADM_BUILDTAG=GIT-hash:\ ba2ce9037989b6141222c7901d1219cf852949f1\ build\ by\ buildd@lcy02-amd64-093\,\ 2024-05-06\ 09:10:38
DRBDADM_API_VERSION=1
DRBD_KERNEL_VERSION_CODE=0x08040b
DRBDADM_VERSION_CODE=0x091c00
DRBDADM_VERSION=9.28.0
root@node51:~# modinfo drbd |grep version
version:        8.4.11
srcversion:     C7B8F7076B8D6DB066D84D9
vermagic:       5.15.0-117-generic SMP mod_unload modversions 
root@node51:~# 
root@node51:~# cat /etc/drbd.d/r0.res 
resource "r0" {
  device minor 1;
  disk "/dev/sdb";
  meta-disk internal;
  on "node51" {
    address   192.168.72.51:7789;
  }
  on "node52" {
    address   192.168.72.52:7789;
  }
}

Get node status, it's Primary

root@node51:~# drbdadm status r0
r0 role:Primary
  disk:UpToDate
  peer role:Secondary
    replication:Established peer-disk:UpToDate

Then reboot node51

root@node51:~# reboot

The Primary become Secondary,and i lost my mount point,

root@node51:~# drbdadm status r0
r0 role:Secondary
  disk:UpToDate
  peer role:Secondary
    replication:Established peer-disk:UpToDate

root@node51:~# 
root@node51:~# lsblk
NAME                 MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0                  7:0    0  63.9M  1 loop /snap/core20/2318
loop1                  7:1    0  63.3M  1 loop /snap/core20/1822
loop2                  7:2    0 111.9M  1 loop /snap/lxd/24322
loop3                  7:3    0    87M  1 loop /snap/lxd/29351
loop4                  7:4    0  49.8M  1 loop /snap/snapd/18357
loop5                  7:5    0  38.8M  1 loop /snap/snapd/21759
sda                    8:0    0   100G  0 disk 
├─sda1                 8:1    0     1G  0 part /boot/efi
├─sda2                 8:2    0     2G  0 part /boot
└─sda3                 8:3    0  96.9G  0 part 
  └─ubuntu--vg-lv--0 253:0    0  96.9G  0 lvm  /
sdb                    8:16   0    20G  0 disk 
└─drbd1              147:1    0    20G  1 disk 
sdc                    8:32   0     1G  0 disk 
sr0                   11:0    1  1024M  0 rom  
root@node51:~# 
root@node51:~# df -hT | grep /data
root@node51:~# 
root@node51:~# 

I must set it Primary again

root@node51:~# drbdadm primary r0
root@node51:~# 
root@node51:~# drbdadm status r0
r0 role:Primary
  disk:UpToDate
  peer role:Secondary
    replication:Established peer-disk:UpToDate

But this mean when system reboot,my application will down all the time, i must run drbdadm primary r0, then mount /data again.

But I want all the statuses to be automatically restored after reboot like before, with the role being PRIMARY and the filesystem mounted properly.

willzhang commented 3 months ago

install latest drbd module and test ok.

root@node51:~# modinfo drbd
filename:       /lib/modules/5.15.0-76-generic/updates/dkms/drbd.ko
softdep:        post: handshake
alias:          block-major-147-*
license:        GPL
version:        9.2.10
description:    drbd - Distributed Replicated Block Device v9.2.10
author:         Philipp Reisner <phil@linbit.com>, Lars Ellenberg <lars@linbit.com>
srcversion:     6A1F71A55858F4949918063
depends:        lru_cache,libcrc32c
retpoline:      Y
name:           drbd
vermagic:       5.15.0-76-generic SMP mod_unload modversions 
sig_id:         PKCS#7
signer:         node51 Secure Boot Module Signature key
sig_key:        3F:93:55:1C:7C:70:0A:56:5B:26:7E:56:98:B4:06:89:E2:78:EF:20
sig_hashalgo:   sha512
signature:      E2:08:90:C8:2A:55:77:89:66:A7:BF:8C:51:81:6C:82:0C:44:F6:DC:
                E8:FC:E3:D0:B6:00:22:CB:37:5E:DA:40:D4:8A:93:CD:73:5F:02:EB:
                FF:DA:A6:EA:47:7F:38:D8:F8:A5:37:52:62:5F:36:3C:29:DE:6B:5D:
                89:32:8D:EA:CE:0B:DD:15:39:B0:5A:A3:52:1B:6E:9D:70:4A:17:60:
                A4:EE:30:45:C2:D5:DA:6C:76:51:1B:A9:FB:F9:9E:F9:67:C9:3A:35:
                EF:85:3A:70:4A:2C:0D:E4:84:9B:41:FD:EC:2B:A2:D2:D4:5C:54:D0:
                EA:F7:3E:33:AB:DC:82:03:76:74:26:75:76:CE:3A:97:F6:14:1B:AC:
                DD:0A:33:E2:63:AF:F0:EB:17:11:4F:9D:D6:A8:15:1E:DA:A5:6E:05:
                30:8B:52:F7:4A:6F:00:5C:B1:D7:56:B8:5D:F6:70:26:8A:1D:8A:24:
                EB:06:11:71:EA:C0:68:16:22:B3:4E:23:F4:1B:79:22:C5:46:3B:F8:
                72:43:23:AC:00:FA:03:A8:AE:39:95:6D:3D:07:05:BC:1D:1B:23:58:
                70:37:4F:17:0B:99:BF:BA:FA:73:FE:27:57:7A:3A:0F:40:6D:F4:00:
                A7:7F:39:A2:43:2C:15:31:75:09:A1:53:EE:1E:6F:00
parm:           enable_faults:int
parm:           fault_rate:int
parm:           fault_count:int
parm:           fault_devs:int
parm:           disable_sendpage:bool
parm:           allow_oos:DONT USE! (bool)
parm:           minor_count:Approximate number of drbd devices (1U-255U) (uint)
parm:           usermode_helper:string
parm:           protocol_version_min:drbd_protocol_version
parm:           strict_names:restrict resource and connection names to ascii alnum and a subset of punct (drbd_strict_names)
root@node51:~#