DRBD安装配置
测试环境
[root@drbd1 ~]# uname -r
3.10.0-862.el7.x86_64
[root@drbd1 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
Host machime | hostname | IP Address |
Host1 | Drbd1 | 192.168.85.71 |
Host2 | Drbd2 | 192.168.85.72 |
安装DBBD
1.设置IP地址
#vi /etc/sysconfig/network-scripts/ifcfg-en33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.85.71
NETMASK=255.255.255.0
GATEWAY=192.168.85.2
DNS1=192.168.85.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=1acc8480-c3dc-4f29-9945-82afac9a68b3
DEVICE=ens33
ONBOOT=yes
- 设置主机名
#hostnamectl set-hostname drbd1
- 设置主机名解析
#vi /etc/hosts
192.168.85.71 drbd1
192.168.85.72 drbd2
4.关闭防火墙
#systemctl disable firewalld
#setenforce 0
5. 安装DRBD
#rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
#yum install drbd90 kmod-drbd90
配置DRBD
#vi /etc/drbd.d/r0.res
resource r0 {
on drbd1 {
device /dev/drbd1;
disk /dev/sdb1;
address 192.168.85.71:7789;
meta-disk internal;
}
on drbd2 {
device /dev/drbd1;
disk /dev/sdb1;
address 192.168.85.72:7789;
meta-disk internal;
}
}
# drbdadm create-md r0
# drbdadm up r0
# drbdadm status r0
r0 role:Secondary
disk:Inconsistent
drbd2 connection:Connecting
# drbdadm primary --force r0(此命令只能在一个节点上执行一次)
[root@drbd1 ~]# drbdadm status r0
r0 role:Primary
disk:UpToDate
drbd2 role:Secondary
replication:SyncSource peer-disk:Inconsistent done:25.00
[root@drbd1 ~]# drbdadm status r0
r0 role:Primary
disk:UpToDate
drbd2 role:Secondary
peer-disk:UpToDate