具体安装请参考http://www.cnblogs.com/rootq/articles/1111141.html

顺便贴上我的配置文件
[root@XENONE data]# cat /etc/drbd.conf
global { usage-count yes; }

             common { syncer { rate 100M; } }

             resource r0 {

                        protocol C;
                        net {

                                 cram-hmac-alg sha1;
                                 shared-secret "FooFunFactory";
                        }

                        on XENONE {

                                 device        /dev/drbd0;
                                 disk            /dev/xvdc1;

                                 address     192.168.4.7:7788;
                                 meta-disk    internal;
                        }
                        on node1 {
                                 device        /dev/drbd0;
                                 disk            /dev/xvdc1;
                                 address     192.168.4.10:7788;
                                 meta-disk    internal;
                        }
             }


1、敲drbdadm create-md r0出现以下错误
you are the 836th user to install this version
md_offset 1069248512
al_offset 1069215744
bm_offset 1069182976

Found ext3 filesystem which uses 1044192 kB
current configuration leaves usable 1044124 kB

Device size would be truncated, which
would corrupt data and result in
'access beyond end of device' errors.
You need to either
   * use external meta data (recommended)
   * shrink that filesystem first
   * zero out the device (destroy the filesystem)
Operation refused.

Command 'drbdmeta 1 v08 /dev/sdb1 internal create-md' terminated with exit code 40
drbdadm create-md r0: exited with code 40

解决方法:这是因为不能在初始化之前装载设备,因为它检测到设备已经使用了!所以会提示出错,所以要把设备卸载了,再敲这条命令


2、[root@node1 /]# mount /dev/drbd0 /data
mount: block device /dev/drbd0 is write-protected, mounting read-only
mount: Wrong medium type

解决方案是敲命令
drbdsetup /dev/drbd0 primary -o
因为还没确定哪台主机为主,所以会导致错误,所以必须要先确定哪台为主服务器,然后再mount设备