[SOLVED] How to configure cluster 2 nodes with DRBD

felipemb

Active Member
Nov 22, 2014
28
4
43
Hi, this is my firts post

I'm going to configure a Cluster of 2-node using DRBD, I first need to configure the node1 and two weeks later configure the node2, here my problem: I don't know how to configure the service drbd for first node and later the second node.

When i try start the service drbd i got this error:

root@nodo1:~# service drbd start
Starting DRBD resources:drbd.d/r0.res:1: resource r0 in:
Missing section ' on <PEER>{...}'.
resource r0: cannot change network config without knowing my peer.
[0]: State change failed: (- 2) Need access to UpToDate data
Command ' / sbin/drbdsetup 0 primary' terminated with exit code 17
0: State change failed: (- 2) Need access to UpToDate data
Command ' / sbin/drbdsetup 0 primary' terminated with exit code 17
0: State change failed: (- 2) Need access to UpToDate data
Command ' / sbin/drbdsetup 0 primary' terminated with exit code 17
0: State change failed: (- 2) Need access to UpToDate data
Command ' / sbin/drbdsetup 0 primary' terminated with exit code 17
0: State change failed: (- 2) Need access to UpToDate data
Command ' / sbin/drbdsetup 0 primary' terminated with exit code 17
root@nodo1:~#

When i try create the PV, i got this error:

root@nodo1:~#pvcreate /dev/drbd0
Device /dev/drbd0 not found (or ignored by filtering).
root@nodo1:~#

My file lvm.conf (filter) is configured:
filter = ["r|/dev/sdb1|", "r|/dev/disk / |", "a|.]*|" ]


Surely my problem is the file global drbd or r0.res because it cannot connect the node2. What should I do to be able to start the service using only the node1 and after configure the node2?

Thank you very much for the time and help
 
Last edited:
Hi, thanks for your time :)

This is my file /etc/drbd.d/global_common.conf

Code:
global {
        usage-count no;
        }


common {
        protocol C;


        startup {
                wfc-timeout 0;
                degr-wfc-timeout 60;
                become-primary-on both;
                }


        net {
                cram-hmac-alg sha1;
                shared-secret "my-secret";
                allow-two-primaries;
                after-sb-0pri discard-zero-changes;
                after-sb-1pri discard-secondary;
                after-sb-2pri disconnect;
                }


        syncer {
                rate 60M;
                verify-alg md5;
                }
        }

And this is my file /etc/drbd.d/r0.res
Code:
resource r0 {


        on nodo1 {
                device /dev/drbd0;
                disk /dev/sdb1;
                address 192.168.50.20:7788;
                meta-disk internal;
                }


        on nodo2 {
                device /dev/drbd0;
                disk /dev/sdb1;
                address 192.168.50.21:7788;
                meta-disk internal;
                }


        }

Where i do specify the section PEER {...}? Or Where it's the error?

Thanks again!!
 
My /etc/drbd.d/drbd0.res file:
Code:
resource drbd0 {
  device /dev/drbd0;
  disk /dev/sdc;
  meta-disk internal;
  protocol C;
  startup {
    wfc-timeout  120;
    degr-wfc-timeout 60;
    become-primary-on both;
  }
  net {
    cram-hmac-alg sha1;
    shared-secret "XXXXXXXXXXXXXXXXXXX";
    allow-two-primaries;
    after-sb-0pri discard-zero-changes;
    after-sb-1pri discard-secondary;
    after-sb-2pri disconnect;
  }
  on vm9 {
    address X.X.X.X:7788;
  }
  on vm10 {
    address X.X.X.X:7788;
  }
}

my /etc/drbd.d/global_common.conf:
Code:
global { usage-count no; }                                                                                                                                                            [1/1861]
common {
  syncer {
    c-plan-ahead 10;
    c-min-rate 50M;
    c-max-rate 100M;
    c-fill-target 2M;
    verify-alg md5;
    al-extents 3389;
  }
  net {
    ko-count 10;
    max-buffers 128k;
    max-epoch-size 16000;
    sndbuf-size 8m;
    rcvbuf-size 8m;
    unplug-watermark 16001;
  }
  disk {
    no-md-flushes;
    no-disk-barrier;
    no-disk-flushes;
  }
}


I use Chef to configure my servers.
Looking at my Chef code, once the drbd config files are created Chef runs these commands on the 'master' node:
Code:
drbdadm create-md drbd0
service drbd start
drbdadm -- --overwrite-data-of-peer primary drbd0
pvcreate /dev/drbd0
vgcreate WhateverYouWantItNamed /dev/drbd0

On the 'slave' node (the one you will add at a later date) Chef runs these commands:
Code:
drbdadm create-md drbd0
service drbd start

At this point DRBD will perform a full sync from 'master' to 'slave'

My DRBD disks are /dev/sdc and /dev/sdd, my lvm.conf filter looks like this:
Code:
    filter = [ "r|/dev/sdc|", "r|/dev/sdd|", "r|/dev/disk/|", "r|/dev/block/|", "a/.*/" ]

Don't blindly copy my settings. Without a battery backed RAID card some of those settings would be dangerous.

Hope that helps!
 
Heyy my friend thanks very much!!

With this simple command:

Code:
[B]drbdadm -- --overwrite-data-of-peer primary r0[/B]

My problem was solved!

Thanks again :)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!