[DRBD-user] drbd local replication with remote replication at the same time

莊凱傑 kcchuang.white at gmail.com
Fri Jun 14 12:41:59 CEST 2019


Hi drbd-user,

I made some code changes for achieving local and remote replication at the
same time. Any idea is appreciated.

Previously I sent a local replication problem email, actually I want to
achieve the goal of drbd local replication with remote replication at the
same time.
I look into the patch f0b6e32, in this patch drbdadm is designed allowing
loopback ip(127.0.0.1) replication by skipping loopback ip check. Hence
local replication is not a problem now.

I want to achieve local replication with remote replication at the same
time. And the function check_addr_conflict still disallow the local host
ip(except for 127.0.0.1) sharing. Hence I'm wondering if we can allow local
other ip sharing as well as follows:
diff --git a/user/shared/shared_tool.c b/user/shared/shared_tool.c
index cdfe9e4..ca17b49 100644
--- a/user/shared/shared_tool.c
+++ b/user/shared/shared_tool.c
@@ -484,9 +484,15 @@ bool addr_scope_local(const char *input)
        struct in6_addr addr6;

        if (inet_pton(AF_INET6, input, &addr6) == 1)
-               return IN6_IS_ADDR_LOOPBACK(&addr6);
+              if (have_ip_ipv6(input) == 1)
+                       return true;
+              else
+                        return IN6_IS_ADDR_LOOPBACK(&addr6);
        else if (inet_pton(AF_INET, input, &addr4) == 1)
-               return IN_IS_ADDR_LOOPBACK(&addr4);
+              if (have_ip_ipv4(input) == 1)
+                       return true;
+              else
+                       return IN_IS_ADDR_LOOPBACK(&addr4);

        return false;
 }

After the above changes, I hope the r0.res and r0-local.res(as attached)
will be bought up successfully. As you can see in r0.res, I hope local and
remote replication being bought up at the same time.

-- 
謝謝
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/drbd-user/attachments/20190614/b0ad3434/attachment-0001.htm>
-------------- next part --------------
resource r0-local {
  disk "/dev/vdb";
  device /dev/drbd2;
  meta-disk internal;
  on k80 {
    node-id 2;
    address 192.168.122.80:7790;
  }
  on local {
    node-id 1;
    address 192.168.122.80:7789;
  }

  connection-mesh {
    hosts  k80 local;
  }
}
-------------- next part --------------
resource r0 {
  device /dev/drbd1;
  meta-disk internal;
  disk "/dev/vda";
  on k80 {
    node-id 1;
    address 192.168.122.80:7789;
  }
  on local {
    node-id 2;
    address 192.168.122.80:7790;
  }
  on k70 {
    node-id 3;
    address 192.168.122.70:7789;
  }
  on k90 {
    node-id 4;
    address 192.168.122.90:7789;
  }

  connection-mesh {
    hosts k80 local k70 k90;
  }
}


More information about the drbd-user mailing list