DRBD 失败:(127) 设备次要未分配

DRBD 失败:(127) 设备次要未分配

我使用 wmware 工作站运行两个OpenVZ 2.6.32-042stab108.2安装在CentOS 6.6.我创建了另一个主分区 ,/dev/sda4将其配置为 drbd 资源。我还在其上创建了一个文件系统。第二台机器实际上是使用第一台机器的虚拟磁盘创建的,并更改了主机名和 eth0 IP 地址。 drbd的配置文件是这样的:

global { usage-count no; } 
common { syncer { rate 100M; } } 
resource r0 { 
        protocol C; 
        startup { 
                wfc-timeout  15; 
                degr-wfc-timeout 60; 
        } 
        net { 
                cram-hmac-alg sha1; 
                shared-secret "password"; 
        } 
        on primary { 
                device /dev/drbd0; 
                disk /dev/sda4; 
                address 192.168.18.10:7788; 
                meta-disk internal; 
        } 
        on secondary { 
                device /dev/drbd0; 
                disk /dev/sda4; 
                address 192.168.18.20:7788; 
                meta-disk internal; 
        } 
}

创建资源后drbdadm 创建-md r0,当我进入服务drbd启动,我得到:

Failure: (127) Device minor not allocated.

的输出drbdadm 全部转储可能会有所帮助:

[root@primary ~]# drbdadm dump all
# /etc/drbd.conf
# resource r0 on primary: not ignored, not stacked
resource r0 {
    protocol               C;
    on primary {
        device           /dev/drbd0 minor 0;
        disk             /dev/sda4;
        address          ipv4 192.168.18.10:7788;
        meta-disk        internal;
    }
    on secondary {
        device           /dev/drbd0 minor 0;
        disk             /dev/sda4;
        address          ipv4 192.168.18.20:7788;
        meta-disk        internal;
    }
    net {
        cram-hmac-alg    sha1;
        shared-secret    danuts;
    }
    startup {
        wfc-timeout       15;
        degr-wfc-timeout  60;
    }
}

是什么导致了这个错误以及如何减轻它?谢谢!

答案1

我刚刚遇到了同样的错误,似乎无法访问第二个节点的 IP 地址。首先我检查了服务状态:

systemctl status drbd.service
â drbd.service - DRBD -- please disable. Unless you are NOT using a cluster manager.
   Loaded: loaded (/usr/lib/systemd/system/drbd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since mar. 2018-04-10 16:21:49 CEST; 5s ago
  Process: 3347 ExecStart=/lib/drbd/drbd start (code=exited, status=20)
 Main PID: 3347 (code=exited, status=20)

avril 10 16:21:49 GROESSLTCL0B systemd[1]: Starting DRBD -- please disable. Unless you are NOT using a cluster manager....
avril 10 16:21:49 GROESSLTCL0B drbd[3347]: Starting DRBD resources: drbd.d/r0.res:20: in resource r0, on GROESSLTCL0B:
avril 10 16:21:49 GROESSLTCL0B drbd[3347]: IP 192.168.254.2 not found on this host.
avril 10 16:21:49 GROESSLTCL0B systemd[1]: drbd.service: main process exited, code=exited, status=20/n/a
avril 10 16:21:49 GROESSLTCL0B systemd[1]: Failed to start DRBD -- please disable. Unless you are NOT using a cluster manager..
avril 10 16:21:49 GROESSLTCL0B systemd[1]: Unit drbd.service entered failed state.
avril 10 16:21:49 GROESSLTCL0B systemd[1]: drbd.service failed.

所以我在 r0.res 中修复了第二个节点的IP,新内容如下:

resource r0 {
     protocol "C";

  net {
    allow-two-primaries;
    after-sb-0pri discard-zero-changes;
    after-sb-1pri discard-secondary;
    after-sb-2pri disconnect;
  }
  on GROESSLTCL0A {
    device /dev/drbd0;
    disk /dev/sdb;
    address 163.104.8.108:7789;
    meta-disk internal;
   }

  on GROESSLTCL0B {
    device /dev/drbd0;
    disk /dev/sdb;
    address 163.104.8.107:7789;
    meta-disk internal;
  }

}

然后我重新创建了资源:

drbdadm create-md r0

之后我重新启动了 drbd 服务,一切都按预期工作。

相关内容