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

    drbd - 图2

    drbd - 图3

    1. [chroot@prod-nfs-server03 ~]$ rpm -qa drbd90-utils
    2. drbd90-utils-9.12.2-1.el7.elrepo.x86_64
    3. [chroot@prod-nfs-server03 ~]$ rpm -ql drbd90-utils
    4. /etc/bash_completion.d/drbdadm
    5. /etc/drbd.conf
    6. /etc/drbd.d
    7. /etc/drbd.d/global_common.conf
    8. /etc/ha.d/resource.d/drbddisk
    9. /etc/ha.d/resource.d/drbdupper
    10. /etc/xen/scripts/block-drbd
    11. /lib/drbd
    12. /lib/drbd/drbd
    13. /lib/drbd/drbdadm-83
    14. /lib/drbd/drbdadm-84
    15. /lib/drbd/drbdsetup-83
    16. /lib/drbd/drbdsetup-84
    17. /usr/lib/drbd
    18. /usr/lib/drbd/crm-fence-peer.9.sh
    19. /usr/lib/drbd/crm-fence-peer.sh
    20. /usr/lib/drbd/crm-unfence-peer.9.sh
    21. /usr/lib/drbd/crm-unfence-peer.sh
    22. /usr/lib/drbd/notify-emergency-reboot.sh
    23. /usr/lib/drbd/notify-emergency-shutdown.sh
    24. /usr/lib/drbd/notify-io-error.sh
    25. /usr/lib/drbd/notify-out-of-sync.sh
    26. /usr/lib/drbd/notify-pri-lost-after-sb.sh
    27. /usr/lib/drbd/notify-pri-lost.sh
    28. /usr/lib/drbd/notify-pri-on-incon-degr.sh
    29. /usr/lib/drbd/notify-split-brain.sh
    30. /usr/lib/drbd/notify.sh
    31. /usr/lib/drbd/outdate-peer.sh
    32. /usr/lib/drbd/rhcs_fence
    33. /usr/lib/drbd/snapshot-resync-target-lvm.sh
    34. /usr/lib/drbd/stonith_admin-fence-peer.sh
    35. /usr/lib/drbd/unsnapshot-resync-target-lvm.sh
    36. /usr/lib/ocf/resource.d/linbit/drbd
    37. /usr/lib/ocf/resource.d/linbit/drbd.shellfuncs.sh
    38. /usr/lib/systemd/system/drbd.service
    39. /usr/lib/tmpfiles.d/drbd.conf
    40. /usr/lib/udev/rules.d/65-drbd.rules
    41. /usr/sbin/drbdadm
    42. /usr/sbin/drbdmeta
    43. /usr/sbin/drbdmon
    44. /usr/sbin/drbdsetup
    45. /usr/share/cluster/drbd.metadata
    46. /usr/share/cluster/drbd.sh
    47. /usr/share/doc/drbd90-utils-9.12.2
    48. /usr/share/doc/drbd90-utils-9.12.2/COPYING
    49. /usr/share/doc/drbd90-utils-9.12.2/ChangeLog
    50. /usr/share/doc/drbd90-utils-9.12.2/README.md
    51. /usr/share/doc/drbd90-utils-9.12.2/drbd.conf.example
    52. /usr/share/man/ja/man5/drbd.conf-8.4.5.gz
    53. /usr/share/man/ja/man5/drbd.conf-9.0.5.gz
    54. /usr/share/man/ja/man5/drbd.conf.5.gz
    55. /usr/share/man/ja/man8/drbd-8.4.8.gz
    56. /usr/share/man/ja/man8/drbd-9.0.8.gz
    57. /usr/share/man/ja/man8/drbd.8.gz
    58. /usr/share/man/ja/man8/drbdadm-8.4.8.gz
    59. /usr/share/man/ja/man8/drbdadm-9.0.8.gz
    60. /usr/share/man/ja/man8/drbdadm.8.gz
    61. /usr/share/man/ja/man8/drbddisk-8.4.8.gz
    62. /usr/share/man/ja/man8/drbdmeta-8.4.8.gz
    63. /usr/share/man/ja/man8/drbdmeta-9.0.8.gz
    64. /usr/share/man/ja/man8/drbdmeta.8.gz
    65. /usr/share/man/ja/man8/drbdmon-9.0.8.gz
    66. /usr/share/man/ja/man8/drbdmon.8.gz
    67. /usr/share/man/ja/man8/drbdsetup-8.4.8.gz
    68. /usr/share/man/ja/man8/drbdsetup-9.0.8.gz
    69. /usr/share/man/ja/man8/drbdsetup.8.gz
    70. /usr/share/man/man5/drbd.conf-8.3.5.gz
    71. /usr/share/man/man5/drbd.conf-8.4.5.gz
    72. /usr/share/man/man5/drbd.conf-9.0.5.gz
    73. /usr/share/man/man5/drbd.conf.5.gz
    74. /usr/share/man/man7/ocf_linbit_drbd.7.gz
    75. /usr/share/man/man8/drbd-8.3.8.gz
    76. /usr/share/man/man8/drbd-8.4.8.gz
    77. /usr/share/man/man8/drbd-9.0.8.gz
    78. /usr/share/man/man8/drbd.8.gz
    79. /usr/share/man/man8/drbdadm-8.3.8.gz
    80. /usr/share/man/man8/drbdadm-8.4.8.gz
    81. /usr/share/man/man8/drbdadm-9.0.8.gz
    82. /usr/share/man/man8/drbdadm.8.gz
    83. /usr/share/man/man8/drbddisk-8.3.8.gz
    84. /usr/share/man/man8/drbddisk-8.4.8.gz
    85. /usr/share/man/man8/drbdmeta-8.3.8.gz
    86. /usr/share/man/man8/drbdmeta-8.4.8.gz
    87. /usr/share/man/man8/drbdmeta-9.0.8.gz
    88. /usr/share/man/man8/drbdmeta.8.gz
    89. /usr/share/man/man8/drbdmon-9.0.8.gz
    90. /usr/share/man/man8/drbdmon.8.gz
    91. /usr/share/man/man8/drbdsetup-8.3.8.gz
    92. /usr/share/man/man8/drbdsetup-8.4.8.gz
    93. /usr/share/man/man8/drbdsetup-9.0.8.gz
    94. /usr/share/man/man8/drbdsetup.8.gz
    95. /var/lib/drbd
    96. [chroot@prod-nfs-server03 ~]$
    1. [chroot@prod-nfs-server03 ~]$ ll /etc/drbd.conf /etc/drbd.d/
    2. -rw-r--r-- 1 root root 133 Apr 5 2020 /etc/drbd.conf
    3. /etc/drbd.d/:
    4. total 12
    5. -rw-r--r-- 1 root root 457 Sep 22 10:15 data.res
    6. -rw-r--r-- 1 root root 2974 Sep 21 06:01 global_common.conf
    7. -rw-r--r-- 1 root root 2563 Apr 5 2020 global_common.conf.bak
    8. [chroot@prod-nfs-server03 ~]$
    1. [chroot@prod-nfs-server03 ~]$ cat /etc/drbd.conf
    2. # You can find an example in /usr/share/doc/drbd.../drbd.conf.example
    3. include "drbd.d/global_common.conf";
    4. include "drbd.d/*.res";
    5. [chroot@prod-nfs-server03 ~]$
    1. [chroot@prod-nfs-server03 ~]$ cat /etc/drbd.d/global_common.conf
    2. # DRBD is the result of over a decade of development by LINBIT.
    3. # In case you need professional services for DRBD or have
    4. # feature requests visit http://www.linbit.com
    5. global {
    6. usage-count no; #是否参加DRBD使用统计,默认为yes。官方统计drbd的装机量,改为no
    7. # Decide what kind of udev symlinks you want for "implicit" volumes
    8. # (those without explicit volume <vnr> {} block, implied vnr=0):
    9. # /dev/drbd/by-resource/<resource>/<vnr> (explicit volumes)
    10. # /dev/drbd/by-resource/<resource> (default for implict)
    11. udev-always-use-vnr; # treat implicit the same as explicit volumes
    12. # minor-count dialog-refresh disable-ip-verification
    13. # cmd-timeout-short 5; cmd-timeout-medium 121; cmd-timeout-long 600;
    14. }
    15. common {
    16. protocol C; #使用DRBD的同步协议,添加这一行
    17. handlers {
    18. # These are EXAMPLE handlers only.
    19. # They may have severe implications,
    20. # like hard resetting the node under certain circumstances.
    21. # Be careful when choosing your poison.
    22. 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";
    23. 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";
    24. local-io-error "/usr/lib/drbd/notify-io-error.sh; /usr/lib/drbd/notify-emergency-shutdown.sh; echo o > /proc/sysrq-trigger ; halt -f";
    25. # fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
    26. # split-brain "/usr/lib/drbd/notify-split-brain.sh root";
    27. # out-of-sync "/usr/lib/drbd/notify-out-of-sync.sh root";
    28. # before-resync-target "/usr/lib/drbd/snapshot-resync-target-lvm.sh -p 15 -- -c 16k";
    29. # after-resync-target /usr/lib/drbd/unsnapshot-resync-target-lvm.sh;
    30. # quorum-lost "/usr/lib/drbd/notify-quorum-lost.sh root";
    31. }
    32. startup {
    33. # wfc-timeout degr-wfc-timeout outdated-wfc-timeout wait-after-sb
    34. }
    35. options {
    36. # cpu-mask on-no-data-accessible
    37. # RECOMMENDED for three or more storage nodes with DRBD 9:
    38. # quorum majority;
    39. # on-no-quorum suspend-io | io-error;
    40. }
    41. disk {
    42. on-io-error detach; #配置I/O错误处理策略为分离
    43. #size on-io-error fencing disk-barrier disk-flushes
    44. # disk-drain md-flushes resync-rate resync-after al-extents
    45. # c-plan-ahead c-delay-target c-fill-target c-max-rate
    46. # c-min-rate disk-timeout
    47. }
    48. net {
    49. # protocol timeout max-epoch-size max-buffers
    50. # connect-int ping-int sndbuf-size rcvbuf-size ko-count
    51. # allow-two-primaries cram-hmac-alg shared-secret after-sb-0pri
    52. # after-sb-1pri after-sb-2pri always-asbp rr-conflict
    53. # ping-timeout data-integrity-alg tcp-cork on-congestion
    54. # congestion-fill congestion-extents csums-alg verify-alg
    55. # use-rle
    56. }
    57. }
    58. [chroot@prod-nfs-server03 ~]$
    1. [chroot@prod-nfs-server03 ~]$ cat /etc/drbd.d/data.res
    2. resource data { #资源名称
    3. protocol C; #使用协议
    4. meta-disk internal;
    5. device /dev/drbd1; #DRBD设备名称
    6. syncer {
    7. verify-alg sha1;# 加密算法
    8. }
    9. net {
    10. allow-two-primaries;
    11. }
    12. on prod-nfs-server04 {
    13. disk /dev/vdc;
    14. address 10.82.100.68:7789; #设置DRBD监听地址与端口
    15. }
    16. on prod-nfs-server03 {
    17. disk /dev/vdc;
    18. address 10.82.100.69:7789;
    19. }
    20. }
    21. [chroot@prod-nfs-server03 ~]$
    1. [chroot@prod-nfs-server03 ~]$ systemctl status drbd.service
    2. drbd.service - DRBD -- please disable. Unless you are NOT using a cluster manager.
    3. Loaded: loaded (/usr/lib/systemd/system/drbd.service; enabled; vendor preset: disabled)
    4. Active: active (exited) since Mon 2020-09-28 02:09:13 CST; 4 months 1 days ago
    5. Process: 1772 ExecStart=/lib/drbd/drbd start (code=exited, status=0/SUCCESS)
    6. Main PID: 1772 (code=exited, status=0/SUCCESS)
    7. CGroup: /system.slice/drbd.service
    8. [chroot@prod-nfs-server03 ~]$ cat cat /proc/drbd
    9. cat: cat: No such file or directory
    10. version: 9.0.22-2 (api:2/proto:86-116)
    11. GIT-hash: 719792f2cc1360c65c848ffdb66090959e27fde5 build by mockbuild@, 2020-04-05 03:16:50
    12. Transports (api:16): tcp (9.0.22-2)
    13. [chroot@prod-nfs-server03 ~]$
    1. [chroot@prod-nfs-server03 ~]$ drbdadm status data
    2. data role:Secondary
    3. disk:UpToDate
    4. prod-nfs-server04 role:Secondary
    5. peer-disk:UpToDate
    6. [chroot@prod-nfs-server03 ~]$ drbdadm cstate data
    7. Connected
    8. [chroot@prod-nfs-server03 ~]$
    1. [root@prod-nfs-server03 ~]# drbdadm status --verbose
    2. drbdsetup status
    3. data role:Secondary
    4. disk:UpToDate
    5. prod-nfs-server04 role:Secondary
    6. peer-disk:UpToDate
    7. [root@prod-nfs-server03 ~]#
    1. [root@prod-nfs-server03 ~]# drbdadm dstate data
    2. UpToDate/UpToDate
    3. [root@prod-nfs-server03 ~]# drbdsetup status data
    4. data role:Secondary
    5. disk:UpToDate
    6. prod-nfs-server04 role:Secondary
    7. peer-disk:UpToDate
    8. [root@prod-nfs-server03 ~]#

    User_Guide_DRBD_9_CN.pdf