drbd+heartbeat

目录

drbd+heartbeat



yum install kernel-devel kernel-headers
tar xvf  .....
cd .... 

./configure --prefix=/usr/local/drbd  --with-km
make
make install

ln -s /usr/local/drbd/etc/drbd.conf /etc/drbd.conf
ln -s /usr/local/drbd/etc/rc.d/init.d/drbd /etc/init.d/drbd

M 192.9.200.146
S 192.9.200.147 

modprobe drbd
chkconfig --add drbd
chkconfig --level 35 drbd on

mknod /dev/drbd0 b 147 0
mknod /dev/sda4 b 147 0
mknod /dev/sda4 b 8 4
mknod /dev/sda4 b 8 4

vim /etc/hosts   
node1
node2

vim /etc/sysconfig/network
node1

vim /etc/sysconfig/network
node2

cat > /etc/drbd.conf <<EOF
global {  usage-count yes;  }
common {
    # 使用协议C.表示收到远程主机的写入确认后,则认为写入完成
    protocol C;
    syncer { rate 3M; }
    startup {
        wfc-timeout 10;
        degr-wfc-timeout 120;
        outdated-wfc-timeout 5;
        }
}
resource r0 {
    device minor 1;
    meta-disk internal;
    # 设置主备机之间通信使用的信息算法.
    net {
        cram-hmac-alg sdc1;
        shared-secret "secret string";
    }
    # 每个主机的说明以"on"开头,后面是主机名.在后面的{}中为这个主机的配置
    on master {
        device /dev/drbd0;
        disk /dev/sda3;
        address 192.9.200.146:7801;
    }
    on slave {
        device /dev/drbd0;
        disk /dev/sdc1;
        address 192.9.200.147:7801;
    }
}
EOF

netstat -lanput |grep 7001

#分区生效
partprobe

node1 node2
drbdadm create-md r0
/etc/init.d/drbd start

drbdadm -- --overwrite-data-of-peer primary r0
mkfs.ext3 /dev/drbd0
mount -o rw /dev/drbd0 /drbd0

drbdadm -- --overwrite-data-of-peer primary r0



目录