DRBD 9.2.14 Configuring a resource to use an IP address instead of a hostname

Please use code blocks to enclose commands, command output, configuration files, log messages, or other CLI content.

commands and command output, configuration file contents, log messages, and other such CLI content

Can DRBD9 configure a resource to use an IP address instead of a hostname? example using hostnames this works.

resource export {
protocol C;
device /dev/drbd0;
meta-disk internal;
on smfgsj-ha1 {
address 10.0.0.81:7789;
disk /dev/mapper/ol-export;
node-id 0;
}
on mfgtest-ha3 {
address 10.0.0.83:7789;
disk /dev/mapper/ol-export;
node-id 1;
}
}

Configure without hostname:

resource export {
protocol C;
device /dev/drbd0;
meta-disk internal;
on 10.0.0.81 {
address 10.0.0.81:7789;
disk /dev/mapper/ol-export;
node-id 0;
}
on 10.0.0.83 {
address 10.0.0.83:7789;
disk /dev/mapper/ol-export;
node-id 1;
}
}

ERROR

drbdadm create-md export
drbd.d/export.res:5: Parse error: ‘TK_STRING | ‘{’’ expected,
but got ‘10.0.0.81’ (TK 279)
[root@smfgsj-ha1 ~]#

​

​

​

The host-name argument must match the Linux host name (uname -n).

So you must specify the host names of the nodes in the on section of the configuration file.

If you could expand on the motivation to not use hostnames in the configuration file I may be able to provide some ideas on how to work within what constraint you have so feel free to share those.

Here is more detail on this:

We currently have high availability clusters at our manufacturing sites where the hostnames are fully qualified domain names: example: site1-ha1.br.net, site1-ha2.br.net.
For consistency we would prefer to use a common name in the resource file, like node1, node2 … This would simplify our configurations to where we don’t need to change the resource file everytime we update the hosts.

I am not sure I really understand the use case here and why you couldn’t just use hostnames, but perhaps a possible solution for you might be to use DRBD’s “floating peers” feature?
(DRBD 9.0 en - LINBIT)

Hello Devin,

Thank you for your emails.
Here is an example of how we currently configure the clusterin three factitious sites. Each site resides in a DMZ. What we would like to do is use an alternate name for each node. That way we could use this universally. Is this possible?

The graphic is somewhat helpful, but it’s still not completely clear to me.

So, we have two nodes in each site, and want all sites connected? If the two nodes utilize shared storage and only one is ever active at a time, then the floating peers features I linked to previously is exactly what you want.

If the nodes all operate independently and have their own storage then just create a six node cluster.

Maybe I have this all wrong and it’s three completely different two node cluster that are not meant to be connected to each other? If so, then just use hostnames per usual.

I suppose what isn’t clear to me is why can’t you just use the hostnames? What is the problem you’re trying to address here?

Hi Devin,

These are three independent clusters with 2 nodes in each. What we are trying to do is use an alternate hostname so that DRBD is not dependent on the hostname. This would simplify our setups. If it is required to have use the hostname then we will have to live with it.

The only other alternative is to use floating peers, as Devin suggested earlier in this thread. Note that floating peer configurations do not rely on hostnames, they instead rely on stable IP addresses. Also, floating peers is currently limited to two nodes only.

For your configuration, this should work:

resource export {
  device    /dev/drbd0;
  disk      /dev/mapper/ol-export;
  meta-disk internal;
 
  floating 10.0.0.81:7788 {
    node-id   0;
  }
 
  floating 10.0.0.82:7788 {
    node-id   1;
  }
}

1 Like

Matt,

Thank you for the information. I will give it a try.

Hi Matt,

Getting errors when trying to configure. Any ideas?

os = oracle linux OL8

drbd version 9.2.14

Config file:

resource export {
  device    /dev/drbd0;
  disk      /dev/mapper/ol-export;
  meta-disk internal;

  floating [10.0.0.81:7788](http://10.0.0.81:7788) {
    node-id   0;
  }

  floating [10.0.0.83:7788](http://10.0.0.83:7788) {
    node-id   1;
  }
}

Output from commands

[root@mfgtest-ha3 ~]# drbdadm create-md export
You want me to create a v09 style flexible-size internal meta data block.
There appears to be a v09 flexible-size internal meta data block
already in place on /dev/mapper/ol-export at byte offset 2858732744704

Do you really want to overwrite the existing meta-data?
[need to type 'yes' to confirm] yes

md_offset 2858732744704
al_offset 2858732711936
bm_offset 2858645467136

Found ext3 filesystem
  2791645964 kB data area apparently used
  2791645964 kB left usable by current configuration

Even though it looks like this would place the new meta data into
unused space, you still need to confirm, as this is only a guess.

Do you want to proceed?
[need to type 'yes' to confirm] yes

initializing activity log
initializing bitmap (83 MB) to all zero
Writing meta data...
New drbd meta data block successfully created.
[root@mfgtest-ha3 ~]#
[root@mfgtest-ha3 ~]# drbdadm up all
export: Failure: (162) Invalid configuration request
additional info from kernel:
invalid name (strict_names=1 allows only [0-9A-Za-z+._-])
Command 'drbdsetup new-peer export 0 --_name=[10.0.0.81:7788](http://10.0.0.81:7788)' terminated with exit code 10
[root@mfgtest-ha3 ~]#

If you look at the example configuration I provided, and then look at the configuration you used, you can see that the IP address and port numbers were turned into markdown links. That’s not the correct syntax and is what DRBD is complaining about.

The email created the links. Here it is not in markdown

resource export {
device /dev/drbd0;
disk /dev/mapper/ol-export;
meta-disk internal;

floating 10.0.0.81:7788 {
node-id 0;
}

floating 10.0.0.83:7788 {
node-id 1;
}
}

Hello Matt,

I was able to get by the strict_name error,below, by running the following:

[root@mfgtest-ha3 ~]# echo 0 > /sys/module/drbd/parameters/strict_names

[root@mfgtest-ha3 ~]# drbdadm up all export: Failure: (162) Invalid configuration request additional info from kernel: invalid name (strict_names=1 allows only [0-9A-Za-z+._-]) Command 'drbdsetup new-peer export 0 --_name=[10.0.0.81:7788](http://10.0.0.81:7788)' terminated with exit code 10 [root@mfgtest-ha3 ~]#

The above is what your configuration should look like. Remove the markdown syntax from the configuration you are using.

I apologize if I didn’t make that clear the first time I mentioned it.

Hi Matt,

You made it clear and as I stated in it shows in markdown from the email only.

In your error output you show this from drbdsetup (which includes the bad/markdown syntax):

[root@mfgtest-ha3 ~]# drbdadm up all export: Failure: (162) Invalid configuration request additional info from kernel: invalid name (strict_names=1 allows only [0-9A-Za-z+._-]) Command 'drbdsetup new-peer export 0 --_name=[10.0.0.81:7788](http://10.0.0.81:7788)' terminated with exit code 10

Maybe I don’t know what you mean when you say, “it shows in markdown from the email only”.

The configuration I’ve written in this post works for me.

Matt,

Thank you! It is working now.

1 Like