Difference between revisions of "DRBD Setup"
From DHVLab
Wiki admin (talk | contribs) |
Wiki admin (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | [[Category: | + | [[Category:OVirt Engine Cluster]] |
== Setting up DRBD == | == Setting up DRBD == | ||
DRBD is the distributed replicated storage system. We use /dev/drbd0 (/dev/drbd/by-res/sync) with ext4, | DRBD is the distributed replicated storage system. We use /dev/drbd0 (/dev/drbd/by-res/sync) with ext4, | ||
Line 106: | Line 106: | ||
drbdadm secondary virt | drbdadm secondary virt | ||
drbdadm secondary sync | drbdadm secondary sync | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | == Add as cluster resource == | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | #drbd service for replication of /sync | ||
+ | pcs resource create ClusterDataSync ocf:linbit:drbd drbd_resource=sync op \ | ||
+ | monitor interval=60s op promote interval=0s demote interval=0s stop \ | ||
+ | interval=0s monitor interval=20s | ||
+ | |||
+ | #adjust drbd settings of sync | ||
+ | pcs resource master ClusterDataSyncS ClusterDataSync master-max=1 master-node-max=1 \ | ||
+ | clone-max=2 clone-node-max=1 notify=true | ||
+ | |||
+ | #drbd service for replication of virt (root hd oVirt engine) | ||
+ | pcs resource create ClusterDataVirt ocf:linbit:drbd \ | ||
+ | drbd_resource=virt op monitor interval=60s op promote interval=0s demote \ | ||
+ | interval=0s stop interval=0s monitor interval=20s | ||
+ | |||
+ | #adjust drbd settings | ||
+ | pcs resource master ClusterDataVirtS ClusterDataVirt master-max=1 \ | ||
+ | master-node-max=1 clone-max=2 clone-node-max=1 notify=true | ||
+ | |||
+ | #take care of mounting /sync on master node | ||
+ | pcs resource create ClusterDataSyncFS Filesystem device="/dev/drbd0" \ | ||
+ | directory="/sync" fstype="ext4" | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 15:25, 8 September 2016
Setting up DRBD
DRBD is the distributed replicated storage system. We use /dev/drbd0 (/dev/drbd/by-res/sync) with ext4, to share data and configuration files that should be available to the cluster master node. It is mounted under /sync. /dev/drbd1 (/dev/drbd/by-res/virt) is used as a VirtIO block device that is directly passed to the KVM, which is a cluster resource.
#install packages
yum -y install drbd84-utils kmod-drbd84
#reboot or load module
modprobe drbd
#install fix if necessary
curl -o /usr/lib/ocf/resource.d/linbit/drbd 'http://git.linbit.com/gitweb.cgi?p=drbd-utils.git;a=blob_plain;f=scripts/drbd.ocf;h=cf6b966341377a993d1bf5f585a5b9fe72eaa5f2;hb=c11ba026bbbbc647b8112543df142f2185cb4b4b'
/etc/drbd.conf
include "drbd.d/global_common.conf";
include "drbd.d/*.res";
/etc/drbd.d/global_common.conf
global {
usage-count yes;
}
common {
handlers {}
startup {}
options {}
disk {}
net {
protocol C;
}
}
/etc/drbd.d/virt.res
resource virt {
protocol C;
meta-disk internal;
device /dev/drbd1;
syncer {
verify-alg sha1;
}
on CLUSTER_N1.clan {
disk /dev/centos/virt;
address CLUSTERLAN_CLUSTER_N1_IP:7790;
}
on CLUSTER_N2.clan {
disk /dev/centos/virt;
address CLUSTERLAN_CLUSTER_N2_IP:7790;
}
}
/etc/drbd.d/sync.res
resource sync {
protocol C;
meta-disk internal;
device /dev/drbd0;
syncer {
verify-alg sha1;
}
on CLUSTER_N1.clan {
disk /dev/centos/sync;
address CLUSTERLAN_CLUSTER_N1_IP:7789;
}
on CLUSTER_N1.clan {
disk /dev/centos/sync;
address CLUSTERLAN_CLUSTER_N2_IP:7789;
}
}
#create drbd
drbdadm create-md virt
drbdadm create-md sync
drbdadm up virt
drbdadm up sync
#start the drbd service
systemctl start drbd.service
#on primary cluster node only!!
drbdadm virt primary --force
drbdadm sync primary --force
#watch synchronization using
cat /proc/drbd
#or
service drbd status
#create sync directory on both nodes
mkdir /sync
#create filesystem on drbd device, primary node only!
mkfs.ext4 /dev/drbd/by-res/sync
#mount device on primary node only!
mount /dev/drbd/by-res/sync /sync
#make secondary node slave. secondary node only!
drbdadm secondary virt
drbdadm secondary sync
Add as cluster resource
#drbd service for replication of /sync
pcs resource create ClusterDataSync ocf:linbit:drbd drbd_resource=sync op \
monitor interval=60s op promote interval=0s demote interval=0s stop \
interval=0s monitor interval=20s
#adjust drbd settings of sync
pcs resource master ClusterDataSyncS ClusterDataSync master-max=1 master-node-max=1 \
clone-max=2 clone-node-max=1 notify=true
#drbd service for replication of virt (root hd oVirt engine)
pcs resource create ClusterDataVirt ocf:linbit:drbd \
drbd_resource=virt op monitor interval=60s op promote interval=0s demote \
interval=0s stop interval=0s monitor interval=20s
#adjust drbd settings
pcs resource master ClusterDataVirtS ClusterDataVirt master-max=1 \
master-node-max=1 clone-max=2 clone-node-max=1 notify=true
#take care of mounting /sync on master node
pcs resource create ClusterDataSyncFS Filesystem device="/dev/drbd0" \
directory="/sync" fstype="ext4"