DRBD安装配置

Posted wujianming

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DRBD安装配置相关的知识,希望对你有一定的参考价值。

DRBD安装配置

 

测试环境

[[email protected] ~]# uname -r

3.10.0-862.el7.x86_64

[[email protected] ~]# 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

  1. 设置主机名

#hostnamectl  set-hostname  drbd1

  1. 设置主机名解析

#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(此命令只能在一个节点上执行一次)

 

[[email protected] ~]# drbdadm status r0

 

r0 role:Primary

  disk:UpToDate

  drbd2 role:Secondary

    replication:SyncSource peer-disk:Inconsistent done:25.00

[[email protected] ~]# drbdadm status r0

r0 role:Primary

  disk:UpToDate

  drbd2 role:Secondary

    peer-disk:UpToDate

 

以上是关于DRBD安装配置的主要内容,如果未能解决你的问题,请参考以下文章

DRBD安装配置工作原理及故障恢复

基于CentOS6.7的DRBD安装配置过程详解

DRBD安装配置工作原理及故障恢复

Drbd的基本概念及简单的Drbd安装配置

drbd:配置和使用

DRBD简介 安装编译报错解决 DRBD的配置初始化及同步