用DRBD和OCFS2实现数据同步和共享(3)

# cat drbd.spec;
# rpmbuild -ba drbd.spec;
# /bin/ls -1 -d /root/rpmbuild/RPMS/i386/*
--------------------------------------------------------------------------------
/root/rpmbuild/RPMS/i386/drbd-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-bash-completion-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-heartbeat-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-pacemaker-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-udev-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-utils-8.3.11-1.el6.i386.rpm
/root/rpmbuild/RPMS/i386/drbd-xen-8.3.11-1.el6.i386.rpm
--------------------------------------------------------------------------------
# rpm -ivh /root/rpmbuild/RPMS/i386/drbd-utils-8.3.11-1.el6.i386.rpm


nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Ref:
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
────────────────────────────────────────────────────────────────────────────────
Configurate the DRBD resource
────────────────────────────────────────────────────────────────────────────────
# vi /etc/drbd.d/global_common.conf;
--------------------------------------------------------------------------------
global {
usage-count yes;
# minor-count dialog-refresh disable-ip-verification
}

common {
protocol C;

handlers {
pri-on-incon-degr "/usr/lib/drbd/notify-pri-on-incon-degr.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f";
pri-lost-after-sb "/usr/lib/drbd/notify-pri-lost-after-sb.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f";
local-io-error "/usr/lib/drbd/notify-io-error.sh; /usr/lib/drbd/notify-emergency-shutdown.sh; echo o > /proc/sysrq-trigger ; halt -f";
# fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
# split-brain "/usr/lib/drbd/notify-split-brain.sh root";
# out-of-sync "/usr/lib/drbd/notify-out-of-sync.sh root";
# before-resync-target "/usr/lib/drbd/snapshot-resync-target-lvm.sh -p 15 -- -c 16k";
# after-resync-target /usr/lib/drbd/unsnapshot-resync-target-lvm.sh;
}

startup {
# wfc-timeout degr-wfc-timeout outdated-wfc-timeout wait-after-sb
wfc-timeout 60;# Wait for connection timeout
degr-wfc-timeout 60;# Wait for connection timeout, if this node was a degraded cluster
}

disk {
# on-io-error fencing use-bmbv no-disk-barrier no-disk-flushes
# no-disk-drain no-md-flushes max-bio-bvecs
on-io-error detach;# Drop the disk on io error
}

net {
# sndbuf-size rcvbuf-size timeout connect-int ping-int ping-timeout max-buffers
# max-epoch-size ko-count allow-two-primaries cram-hmac-alg shared-secret
# after-sb-0pri after-sb-1pri after-sb-2pri data-integrity-alg no-tcp-cork
}

syncer {
# rate after al-extents use-rle cpu-mask verify-alg csums-alg
rate 10M;# Limit sync speed to 10 MByte/s for FastEthernet
}
}
--------------------------------------------------------------------------------
Note: on 100Mbit ethernet cannot expect more than 12.5 MByte total transfer rate.

You must specify the wfc-timeout with non-zero value, as the default value is 0
and it means unlimit, the DRBD service will wait forever untill find other node.


# cat /etc/drbd.conf
--------------------------------------------------------------------------------
# You can find an example in  /usr/share/doc/drbd.../drbd.conf.example
include "drbd.d/global_common.conf";
include "drbd.d/*.res";
--------------------------------------------------------------------------------


# cat /usr/share/doc/drbd83-utils-8.3.13/drbd.conf.example


# vi /etc/drbd.d/ocfs2.res;
--------------------------------------------------------------------------------
# DRBD resource for OCFS2 storage
resource ocfs2 {
  protocol C;
  on centos6-ocfs2-1 {
    device    /dev/drbd0;
    disk      /dev/sdb1;
    address   192.168.56.201:7789;
    meta-disk internal;
  }
  on centos6-ocfs2-2 {
    device    /dev/drbd0;
    disk      /dev/sdb1;
    address   192.168.56.202:7789;
    meta-disk internal;
  }
}
--------------------------------------------------------------------------------
Note: this setting need to change later when Switch DRBD to Active-Active mode


# vi /etc/hosts;
--------------------------------------------------------------------------------
192.168.56.201 centos6-ocfs2-1 co1
192.168.56.202 centos6-ocfs2-2 co2
--------------------------------------------------------------------------------


# scp /etc/drbd.d/global_common.conf  centos6-ocfs2-2:/etc/drbd.d/
# scp /etc/drbd.d/ocfs2.res  centos6-ocfs2-2:/etc/drbd.d/

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/629ebe60a358b37b031eb21782d36a2c.html