系统相关
首页 > 系统相关> > centos7.6部署DRBD提示“no resources defined!

centos7.6部署DRBD提示“no resources defined!

作者:互联网

环境准备:

node1(主节点)IP: 192.168.26.30 主机名:node1
node2(从节点)IP: 192.168.26.31 主机名:node2

1.关闭防火墙和selinux 

#setenforce 0

#firewall-cmd --set-default-zone=trusted

2.更改主机名和hosts记录(node1、node2)

#hostnamectl set-hostname=nodex

#uname -n

3.安装依赖包 

# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
# yum install -y kmod-drbd84 drbd84-utils
# systemctl enable drbd
4.加载DRBD模块、查看DRBD模块是否加载到内核(如果失败就重启系统再次加载)

# modprobe drbd
# lsmod |grep drbd

5.编写资源文件

resource r0 {

on node1{#这里的主机名要和uname -n显示的保持一致 不然可能会出现否则会提示“no resources defined!
address 192.168.26.30:7788;
disk /dev/vg0/lv0;
device /dev/drbd0;
meta-disk internal;
}

on node2{
address 192.168.26.31:7788;
disk /dev/vg0/lv0;
device /dev/drbd0;
meta-disk internal;

}

}

6.关闭drbd

#systemctl stop drbd

7.创建DRBD设备并激活指定资源

#drbdadm create-md r0 //如果出现“no resources defined!“需要指定配置文件的路径  drbdadm  -c /etc/drbd.d/xx.res   create-md r0

8.启动DRBD服务(两台机器都要同时启动,不然启动不起来)

#node1 --- systemctl start drbd.servide

#node2 --- systemctl start drbd.service

9.查看状态

#lsblk

#cat /proc/drbd

............................................

标签:no,DRBD,elrepo,192.168,主机名,defined,drbd,disk
来源: https://www.cnblogs.com/heyongshen/p/15938747.html