C、创建硬件设备drbd mknod /dev/drbd0 b 147 0 mknod /dev/drbd1 b 147 1 mknod /dev/drbd2 b 147 2 或者用shell来建立多个: #for i in $(seq 0 15) ; do mknod /dev/drbd$i b 147 $i ; done
3、配置drbd
修改/etc/drbd.conf 主要修改了:机器名和设备名ip地址 ====================================================== on nannan{ device /dev/drbd0; disk /dev/hdc3; address 192.168.0.136:7788; meta-disk internal;
# meta-disk is either 'internal' or '/dev/ice/name [idx]' # # You can use a single block device to store meta-data # of multiple DRBD's. # E.g. use meta-disk /dev/hde6[0]; and meta-disk /dev/hde6[1]; # for two different resources. In this case the meta-disk # would need to be at least 256 MB in size. # # 'internal' means, that the last 128 MB of the lower device # are used to store the meta-data. # You must not give an index with 'internal'. }
on root { device /dev/drbd0; disk /dev/hdc2; address 192.168.0.139:7788; meta-disk internal; } ====================================================== 下面是整个drbd.conf的配置文件 注意:配置的版本是drbd-0.7.19.tar.gz 不同版本无法兼容。 修改的地方就以上几个地方和注释 还有把除了resource r0 外的其他配置块如resource r1等。 也就是说/**** on root { device /dev/drbd0; disk /dev/hdc2; address 192.168.0.139:7788; meta-disk internal; } } ****/后面的所有内容
# # drbd.conf example #
skip { As you can see, you can also comment chunks of text with a 'skip[optional nonsense]{ skipped text }' section. This comes in handy, if you just want to comment out some 'resource {...}' section: just precede it with 'skip'.
The basic format of option assignment is
# The user dialog counts and displays the seconds it waited so # far. You might want to disable this if you have the console # of your server connected to a serial terminal server with # limited logging capacity. # The Dialog will print the count each 'dialog-refresh' seconds, # set it to 0 to disable redrawing completely. [ default = 1 ] # # dialog-refresh 5; # 5 seconds
# You might disable one of drbdadm's sanity check. # disable-ip-verification; # } # # this need not be r#, you may use phony resource names, # like "resource web" or "resource mail", too #
resource r0 {
protocol C;
# what should be done in case the cluster starts up in # degraded mode, but knows it has inconsistent data. incon-degr-cmd "echo '!DRBD! pri on incon-degr' | wall ; sleep 60 ; halt -f";
startup { degr-wfc-timeout 120; # 2 minutes. }
disk { }
net { }
syncer { rate 10M; group 1; al-extents 257; }
on nannan{ device /dev/drbd0; disk /dev/hdc3; address 192.168.0.136:7788; meta-disk internal;
}
on root { device /dev/drbd0; disk /dev/hdc2; address 192.168.0.139:7788; meta-disk internal; } }