Why can't create resource for DRBD on CentOS 7?

3.1k Views Asked by At

Follow this guide to install DRBD on CentOS 7.3:

http://www.learnitguide.net/2016/07/how-to-install-and-configure-drbd-on-linux.html

After this step:

resource testdata1 {
protocol C;           
on node1 {
        device /dev/drbd0;
        disk /dev/sdb;
        address 172.16.2.61:7788;
        meta-disk internal;
    }
    on node2 {
        device /dev/drbd0;
        disk /dev/sdb;
        address 172.16.2.62:7788;
        meta-disk internal;
    }
} 

When run :

drbdadm create-md testdata1

Got message:

'testdata1' not defined in your config (for this host).

The /etc/hosts is:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

172.16.2.61              node1.clusterbr.int   node1
172.16.2.62              node2.clusterbr.int   node2
172.16.2.60              dbip.clusterbr.int   node1

The /etc/drbd.conf config is:

# You can find an example in  /usr/share/doc/drbd.../drbd.conf.example

include "drbd.d/global_common.conf";
include "drbd.d/*.res";

What's the reason of the problem?

4

There are 4 best solutions below

0
On BEST ANSWER

The reason was didn't set the right hostname on drbd config file.

Use uname -a can see the hostname. Set it to config.

Thanks to this:

https://newbiedba.wordpress.com/2015/09/21/drbd-not-defined-in-your-config-for-this-host/

0
On

in the tutorial when editing "etc/drbd.d/testdata1.res" on node1 on node2

those two are the name of the machine. you need to replace those by yours. example : on machine1 on machine2

0
On

To Solve this issue Note: Same configuration file present on both host under /etc/drbd.d/*.res

  1. First allow communication on port 7788

  2. Then check hostname of nodes # hostname and verify #vi /etc/sysconfig/network contain same hostname

  3. Last but not least

    # vi /etc/hosts

    <IP1> node1.abc.com node1

    <IP2> node2.abc.com node2

    ... save it and then

  4. #drbdadm create-md testdata1

Best Luck

0
On
resource testdata1 {
protocol C;           
on node1 {  <<<<<<<<<<<< put your host name by useing CMD "hostname" istead of node1

        device /dev/drbd0;
        disk /dev/sdb;
        address 172.16.2.61:7788;
        meta-disk internal;
    }
    on node2 { <<<<<<< put your host name by useing CMD "hostname" istead of node2

        device /dev/drbd0;
        disk /dev/sdb;
        address 172.16.2.62:7788;
        meta-disk internal;
    }
}