1

i'm trying to learn drbd with centoOS 6.3 on virtual box, i have two vm configed, the node1 and node2, i copy the a file to the mount point /data which is /dev/drbd0 of node1, but not reflect to the node2's /data

here is the config

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

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

global {
    # do not participate in online usage survey
    usage-count no;
}

resource data {

    # write IO is reported as completed if it has reached both local
    # and remote disk
    protocol C;

    net {
        # set up peer authentication
        cram-hmac-alg sha1;
        shared-secret "s3cr3tp@ss";
        # default value 32 - increase as required
        max-buffers 512;
        # highest number of data blocks between two write barriers
        max-epoch-size 512;
        # size of the TCP socket send buffer - can tweak or set to 0 to
        # allow kernel to autotune
        sndbuf-size 0;
    }

    startup {
        # wait for connection timeout - boot process blocked
        # until DRBD resources are connected
        wfc-timeout 30;
        # WFC timeout if peer was outdated
        outdated-wfc-timeout 20;
        # WFC timeout if this node was in a degraded cluster (i.e. only had one
        # node left)
        degr-wfc-timeout 30;
    }

    disk {
        # the next two are for safety - detach on I/O error
        # and set up fencing - resource-only will attempt to
        # reach the other node and fence via the fence-peer
        # handler
         #on-io-error detach;
         #fencing resource-only;
        # no-disk-flushes; # if we had battery-backed RAID
        # no-md-flushes; # if we had battery-backed RAID
        # ramp up the resync rate
        # resync-rate 10M;
    }
    handlers {
        # specify the two fencing handlers
        # see: http://www.drbd.org/users-guide-8.4/s-pacemaker-fencing.html
        fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
        after-resync-target "/usr/lib/drbd/crm-unfence-peer.sh";
    }
    # first node
    on node1 {
        # DRBD device
        device /dev/drbd0;
        # backing store device
        disk /dev/sdb;
        # IP address of node, and port to listen on
        address 192.168.1.101:7789;
        # use internal meta data (don't create a filesystem before
        # you create metadata!)
        meta-disk internal;
    }
    # second node
    on node2 {
        # DRBD debice
        device /dev/drbd0;
        # backing store device
        disk /dev/sdb;
        # IP address of node, and port to listen on
        address 192.168.1.102:7789;
        # use internal meta data (don't create a filesystem before
        # you create metadata!)
        meta-disk internal;
    }
}

here is the cat /proc/drbd

cat: /proc/data: No such file or directory
[root@node1 /]# cat /proc/drbd
version: 8.3.16 (api:88/proto:86-97)
GIT-hash: a798fa7e274428a357657fb52f0ecf40192c1985 build by phil@Build64R6, 2013-09-27 16:00:43
 0: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r-----
    ns:543648 nr:0 dw:265088 dr:280613 al:107 bm:25 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:7848864
    [>...................] sync'ed:  6.5% (7664/8188)M
    finish: 7:47:11 speed: 272 (524) K/sec

i copied a file to /data in node 1, but i can't find the file in /date in node2, anyone can help?

drbd status on node1

[root@node1 /]# service drbd status
drbd driver loaded OK; device status:
version: 8.3.16 (api:88/proto:86-97)
GIT-hash: a798fa7e274428a357657fb52f0ecf40192c1985 build by phil@Build64R6, 2013-09-27 16:00:43
m:res   cs          ro                 ds                     p  mounted  fstype
0:data  SyncSource  Primary/Secondary  UpToDate/Inconsistent  C  /data    ext3
...     sync'ed:    8.1%               (7536/8188)M
2

Prove me wrong, but IIRC you can only mount a FS on one of the nodes at the same time. Have them sync up, unmount /data. Switch-over, mount it on node2 and you should see all the data.

| improve this answer | |
  • 1
    any methods i can see the sync-ed data in node2? – hkguile Nov 3 '14 at 8:09
  • see Oliver's answer below, you'll need a cluster filesystem. – vautee Nov 3 '14 at 8:20
  • what happen if i unmount /data on node1 if the system is writing data on it? and how can i know node2 is 100% sync-ed? i use cat/proc/drbd there is % showing, but it is increasing very slow, what is that? – hkguile Nov 3 '14 at 9:02
  • As your output of /proc/drbd says: [>...................] sync'ed: 6.5% (7664/8188)M finish: 7:47:11 speed: 272 (524) K/sec - so it is syncing, has still 7664MB to do and will finish in about 7 hours and 47 minutes. Regarding sync speed and configuring this and that - have a look at the drbd Users Guide drbd.org/users-guide – vautee Nov 3 '14 at 9:03
3

DRBD means Distributed Replicated Block Device. It is not a filesystem.

If you write a file on your primary node, the filesystem issues write operations. On the layer just below, DRBD makes sure these writes get replicated to a secondary node. For the secondary node, these writes appear just as data blocks. In order for it to see files, you will typically have to unmount your partition on the primary node and mount it on the secondary node.

There is a solution to what you want to achieve, though. For this, you will need a cluster filesystem. Such a filesystem allows you to have the partition mounted on two nodes at the same time. With commonly used filesystems such as ext4 this is not possible.

An example of such a cluster filesystem which works on top of DRBD is OCFS2. In order to use this filesystem and have the partition mounted on both servers at the same time, your DRBD resource will need to be configured in dual primary mode. This means that there is no primary node. Both nodes are allowed to write to the resource at the same time. The cluster filesystem makes sure the data written is consistent.

| improve this answer | |
  • +1, but with the note that the OP probably doesn't want this (dual primary is not without risk). He probably wants a NFS/SMB fileserver with the data partition replicated then. – Halfgaar Nov 3 '14 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.