DRBD-软件是用于Linux平台的分布式复制的存储系统
https://www.linbit.com/drbd/


[chroot@prod-nfs-server03 ~]$ rpm -qa drbd90-utilsdrbd90-utils-9.12.2-1.el7.elrepo.x86_64[chroot@prod-nfs-server03 ~]$ rpm -ql drbd90-utils/etc/bash_completion.d/drbdadm/etc/drbd.conf/etc/drbd.d/etc/drbd.d/global_common.conf/etc/ha.d/resource.d/drbddisk/etc/ha.d/resource.d/drbdupper/etc/xen/scripts/block-drbd/lib/drbd/lib/drbd/drbd/lib/drbd/drbdadm-83/lib/drbd/drbdadm-84/lib/drbd/drbdsetup-83/lib/drbd/drbdsetup-84/usr/lib/drbd/usr/lib/drbd/crm-fence-peer.9.sh/usr/lib/drbd/crm-fence-peer.sh/usr/lib/drbd/crm-unfence-peer.9.sh/usr/lib/drbd/crm-unfence-peer.sh/usr/lib/drbd/notify-emergency-reboot.sh/usr/lib/drbd/notify-emergency-shutdown.sh/usr/lib/drbd/notify-io-error.sh/usr/lib/drbd/notify-out-of-sync.sh/usr/lib/drbd/notify-pri-lost-after-sb.sh/usr/lib/drbd/notify-pri-lost.sh/usr/lib/drbd/notify-pri-on-incon-degr.sh/usr/lib/drbd/notify-split-brain.sh/usr/lib/drbd/notify.sh/usr/lib/drbd/outdate-peer.sh/usr/lib/drbd/rhcs_fence/usr/lib/drbd/snapshot-resync-target-lvm.sh/usr/lib/drbd/stonith_admin-fence-peer.sh/usr/lib/drbd/unsnapshot-resync-target-lvm.sh/usr/lib/ocf/resource.d/linbit/drbd/usr/lib/ocf/resource.d/linbit/drbd.shellfuncs.sh/usr/lib/systemd/system/drbd.service/usr/lib/tmpfiles.d/drbd.conf/usr/lib/udev/rules.d/65-drbd.rules/usr/sbin/drbdadm/usr/sbin/drbdmeta/usr/sbin/drbdmon/usr/sbin/drbdsetup/usr/share/cluster/drbd.metadata/usr/share/cluster/drbd.sh/usr/share/doc/drbd90-utils-9.12.2/usr/share/doc/drbd90-utils-9.12.2/COPYING/usr/share/doc/drbd90-utils-9.12.2/ChangeLog/usr/share/doc/drbd90-utils-9.12.2/README.md/usr/share/doc/drbd90-utils-9.12.2/drbd.conf.example/usr/share/man/ja/man5/drbd.conf-8.4.5.gz/usr/share/man/ja/man5/drbd.conf-9.0.5.gz/usr/share/man/ja/man5/drbd.conf.5.gz/usr/share/man/ja/man8/drbd-8.4.8.gz/usr/share/man/ja/man8/drbd-9.0.8.gz/usr/share/man/ja/man8/drbd.8.gz/usr/share/man/ja/man8/drbdadm-8.4.8.gz/usr/share/man/ja/man8/drbdadm-9.0.8.gz/usr/share/man/ja/man8/drbdadm.8.gz/usr/share/man/ja/man8/drbddisk-8.4.8.gz/usr/share/man/ja/man8/drbdmeta-8.4.8.gz/usr/share/man/ja/man8/drbdmeta-9.0.8.gz/usr/share/man/ja/man8/drbdmeta.8.gz/usr/share/man/ja/man8/drbdmon-9.0.8.gz/usr/share/man/ja/man8/drbdmon.8.gz/usr/share/man/ja/man8/drbdsetup-8.4.8.gz/usr/share/man/ja/man8/drbdsetup-9.0.8.gz/usr/share/man/ja/man8/drbdsetup.8.gz/usr/share/man/man5/drbd.conf-8.3.5.gz/usr/share/man/man5/drbd.conf-8.4.5.gz/usr/share/man/man5/drbd.conf-9.0.5.gz/usr/share/man/man5/drbd.conf.5.gz/usr/share/man/man7/ocf_linbit_drbd.7.gz/usr/share/man/man8/drbd-8.3.8.gz/usr/share/man/man8/drbd-8.4.8.gz/usr/share/man/man8/drbd-9.0.8.gz/usr/share/man/man8/drbd.8.gz/usr/share/man/man8/drbdadm-8.3.8.gz/usr/share/man/man8/drbdadm-8.4.8.gz/usr/share/man/man8/drbdadm-9.0.8.gz/usr/share/man/man8/drbdadm.8.gz/usr/share/man/man8/drbddisk-8.3.8.gz/usr/share/man/man8/drbddisk-8.4.8.gz/usr/share/man/man8/drbdmeta-8.3.8.gz/usr/share/man/man8/drbdmeta-8.4.8.gz/usr/share/man/man8/drbdmeta-9.0.8.gz/usr/share/man/man8/drbdmeta.8.gz/usr/share/man/man8/drbdmon-9.0.8.gz/usr/share/man/man8/drbdmon.8.gz/usr/share/man/man8/drbdsetup-8.3.8.gz/usr/share/man/man8/drbdsetup-8.4.8.gz/usr/share/man/man8/drbdsetup-9.0.8.gz/usr/share/man/man8/drbdsetup.8.gz/var/lib/drbd[chroot@prod-nfs-server03 ~]$
[chroot@prod-nfs-server03 ~]$ ll /etc/drbd.conf /etc/drbd.d/-rw-r--r-- 1 root root 133 Apr 5 2020 /etc/drbd.conf/etc/drbd.d/:total 12-rw-r--r-- 1 root root 457 Sep 22 10:15 data.res-rw-r--r-- 1 root root 2974 Sep 21 06:01 global_common.conf-rw-r--r-- 1 root root 2563 Apr 5 2020 global_common.conf.bak[chroot@prod-nfs-server03 ~]$
[chroot@prod-nfs-server03 ~]$ cat /etc/drbd.conf# You can find an example in /usr/share/doc/drbd.../drbd.conf.exampleinclude "drbd.d/global_common.conf";include "drbd.d/*.res";[chroot@prod-nfs-server03 ~]$
[chroot@prod-nfs-server03 ~]$ cat /etc/drbd.d/global_common.conf# DRBD is the result of over a decade of development by LINBIT.# In case you need professional services for DRBD or have# feature requests visit http://www.linbit.comglobal {usage-count no; #是否参加DRBD使用统计,默认为yes。官方统计drbd的装机量,改为no# Decide what kind of udev symlinks you want for "implicit" volumes# (those without explicit volume <vnr> {} block, implied vnr=0):# /dev/drbd/by-resource/<resource>/<vnr> (explicit volumes)# /dev/drbd/by-resource/<resource> (default for implict)udev-always-use-vnr; # treat implicit the same as explicit volumes# minor-count dialog-refresh disable-ip-verification# cmd-timeout-short 5; cmd-timeout-medium 121; cmd-timeout-long 600;}common {protocol C; #使用DRBD的同步协议,添加这一行handlers {# These are EXAMPLE handlers only.# They may have severe implications,# like hard resetting the node under certain circumstances.# Be careful when choosing your poison.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;# quorum-lost "/usr/lib/drbd/notify-quorum-lost.sh root";}startup {# wfc-timeout degr-wfc-timeout outdated-wfc-timeout wait-after-sb}options {# cpu-mask on-no-data-accessible# RECOMMENDED for three or more storage nodes with DRBD 9:# quorum majority;# on-no-quorum suspend-io | io-error;}disk {on-io-error detach; #配置I/O错误处理策略为分离#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 {# protocol timeout max-epoch-size max-buffers# 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}}[chroot@prod-nfs-server03 ~]$
[chroot@prod-nfs-server03 ~]$ cat /etc/drbd.d/data.resresource data { #资源名称protocol C; #使用协议meta-disk internal;device /dev/drbd1; #DRBD设备名称syncer {verify-alg sha1;# 加密算法}net {allow-two-primaries;}on prod-nfs-server04 {disk /dev/vdc;address 10.82.100.68:7789; #设置DRBD监听地址与端口}on prod-nfs-server03 {disk /dev/vdc;address 10.82.100.69:7789;}}[chroot@prod-nfs-server03 ~]$
[chroot@prod-nfs-server03 ~]$ systemctl status drbd.service● drbd.service - DRBD -- please disable. Unless you are NOT using a cluster manager.Loaded: loaded (/usr/lib/systemd/system/drbd.service; enabled; vendor preset: disabled)Active: active (exited) since Mon 2020-09-28 02:09:13 CST; 4 months 1 days agoProcess: 1772 ExecStart=/lib/drbd/drbd start (code=exited, status=0/SUCCESS)Main PID: 1772 (code=exited, status=0/SUCCESS)CGroup: /system.slice/drbd.service[chroot@prod-nfs-server03 ~]$ cat cat /proc/drbdcat: cat: No such file or directoryversion: 9.0.22-2 (api:2/proto:86-116)GIT-hash: 719792f2cc1360c65c848ffdb66090959e27fde5 build by mockbuild@, 2020-04-05 03:16:50Transports (api:16): tcp (9.0.22-2)[chroot@prod-nfs-server03 ~]$
[chroot@prod-nfs-server03 ~]$ drbdadm status datadata role:Secondarydisk:UpToDateprod-nfs-server04 role:Secondarypeer-disk:UpToDate[chroot@prod-nfs-server03 ~]$ drbdadm cstate dataConnected[chroot@prod-nfs-server03 ~]$
[root@prod-nfs-server03 ~]# drbdadm status --verbosedrbdsetup statusdata role:Secondarydisk:UpToDateprod-nfs-server04 role:Secondarypeer-disk:UpToDate[root@prod-nfs-server03 ~]#
[root@prod-nfs-server03 ~]# drbdadm dstate dataUpToDate/UpToDate[root@prod-nfs-server03 ~]# drbdsetup status datadata role:Secondarydisk:UpToDateprod-nfs-server04 role:Secondarypeer-disk:UpToDate[root@prod-nfs-server03 ~]#
