# 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
}
options {
# cpu-mask on-no-data-accessible
}
disk {
on-io-error detach;
# size on-io-error fencing disk-barrier disk-flushes
# disk-drain md-flushes resync-rate resync-after al-extents
# c-plan-ahead c-delay-target c-fill-target c-max-rate
# c-min-rate disk-timeout
}
net {
cram-hmac-alg "sha1";
shared-secret "mydrbdlab";
#下面三条是脑裂的自动处理策略
after-sb-0pri discard-older-primary;
after-sb-1pri discard-secondary;
after-sb-2pri call-pri-lost-after-sb;
# protocol timeout max-epoch-size max-buffers unplug-watermark
# connect-int ping-int sndbuf-size rcvbuf-size ko-count
# allow-two-primaries cram-hmac-alg shared-secret after-sb-0pri
# after-sb-1pri after-sb-2pri always-asbp rr-conflict
# ping-timeout data-integrity-alg tcp-cork on-congestion
# congestion-fill congestion-extents csums-alg verify-alg
# use-rle
}
syncer {
rate 1000M;
}
}
4、添加资源文件:
[root@node1 ~]# vim /etc/drbd.d/mysql.res
resource mysql {
on node1.test.com {
device /dev/drbd0;
disk /dev/sdb1;
address 172.18.109.233:7789;
meta-disk internal;
}
on node2.test.com {
device /dev/drbd0;
disk /dev/sdb1;
address 172.18.109.235:7789;
meta-disk internal;
}
}
5、将配置文件为node2提供一份
[root@node1 ~]# scp /etc/drbd.d/{global_common.conf,mysql.res} node2:/etc/drbd.d/
global_common.conf 100% 2212 2.2KB/s 00:00
mysql.res 100% 291 0.3KB/s 00:00
6、初始化资源并启动服务
node1:
[root@node1 ~]# drbdadm create-md mysql
initializing activity log
NOT initializing bitmap
Writing meta data...
New drbd meta data block successfully created. #提示已经创建成功
[root@node1 ~]# start drbd start
start: Unknown job: drbd
[root@node1 ~]# service drbd start #启动服务
Starting DRBD resources: [
create res: mysql
prepare disk: mysql
adjust disk: mysql
adjust net: mysql
]
..........
***************************************************************
DRBD's startup script waits for the peer node(s) to appear.
- If this node was already a degraded cluster before the
reboot, the timeout is 0 seconds. [degr-wfc-timeout]
- If the peer was available before the reboot, the timeout
is 0 seconds. [wfc-timeout]
(These values are for resource 'mysql'; 0 sec -> wait forever)
To abort waiting enter 'yes' [ 32]: yes
(责任编辑:liangzh) |