Zwei Nodes
install corosync und pacemaker
- root@twix:~# apt-get install -y pacemaker corosync
- root@raider:~# apt-get install -y pacemaker corosync
key exchange
- root@twix:~# ssh-keygen
- root@twix:~# ssh-copy-id raider
- root@raider:~# ssh-keygen
- root@raider:~# ssh-copy-id twix
script for lazy people
- root@twix:/etc/drbd.d# cat /usr/local/sbin/sync-us
#!/bin/bash
OTHER=raider
rsync -avzx $* $OTHER:$PWD/
- root@raider:/etc/drbd.d# cat /usr/local/sbin/sync-us
#!/bin/bash
OTHER=twix
rsync -avzx $* $OTHER:$PWD/
corosync set
- root@twix:~# sed -i "s/bindnetaddr: 127.0.0.1/bindnetaddr: 10.0.0.0/g" /etc/corosync/corosync.conf
- root@twix:~# sed -i "s/START=no/START=yes/" /etc/default/corosync
syncronisize
- root@twix:~# rsync -avz /etc/corosync/corosync.conf raider:/etc/corosync/corosync.conf
- root@twix:~# rsync -avz /etc/default/corosync raider:/etc/default/corosync
autostart pacemaker
- root@twix:~# update-rc.d pacemaker defaults
- root@raider:~# update-rc.d pacemaker defaults
start systems
- root@twix:~# service corosync start
- root@twix:~# service pacemaker start
- root@raider:~# service corosync start
- root@raider:~# service pacemaker start
first check
- root@twix:~# crm configure show
node $id="167772162" raider
node $id="167772163" twix
property $id="cib-bootstrap-options" \
dc-version="1.1.10-42f2063" \
cluster-infrastructure="corosync"
- root@raider:~# crm configure show
node $id="167772162" raider
node $id="167772163" twix
property $id="cib-bootstrap-options" \
dc-version="1.1.10-42f2063" \
cluster-infrastructure="corosync"
first settings
primitive virtual-ip ocf:heartbeat:IPaddr \
params ip="192.168.244.100" nic="eth0" cidr_netmask="21"
property stonith-enabled=false
commit
EOF
drbd
drbd install
- root@twix:~# apt-get install drbd8-utils -y
- root@raider:~# apt-get install drbd8-utils -y
min config
- root@twix:# cat /etc/drbd.conf
global { usage-count yes; }
common {
syncer { rate 100M; }
protocol C;
}
resource store {
device /dev/drbd0;
meta-disk internal;
on twix {
disk /dev/vdb;
address 10.0.0.2:7788;
}
on raider {
disk /dev/vdb;
address 10.0.0.3:7788;
}
}
- root@twix:/etc# sync-us drbd.conf
create drbd md
- root@raider:~# drbdadm create-md store
- root@raider:~# drbdadm create-md store
drbd up
- root@twix:~# drbdadm up store
- root@raider:~# drbdadm up store
check drbd
version: 8.4.3 (api:1/proto:86-101)
srcversion: F97798065516C94BE0F27DC
0: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:10485404
define master
- root@twix:~# drbdsetup /dev/drbd0 primary --o
check drbd
- root@twix:~# cat /proc/drbd
version: 8.4.3 (api:1/proto:86-101)
srcversion: F97798065516C94BE0F27DC
0: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r---n-
ns:5246404 nr:0 dw:0 dr:5251800 al:0 bm:319 lo:0 pe:12 ua:5 ap:0 ep:1 wo:f oos:5250716
[=========>..........] sync'ed: 50.0% (5124/10236)Mfinish: 0:01:15 speed: 69,144 (68,876) K/sec
format
- root@twix:~# mkfs.ext4 /dev/drbd0
disable drbd autostart
- root@twix:~# update-rc.d drbd disable
- root@raider:~# update-rc.d drbd disable
drbd over corosync master slave mode
node $id="167772162" raider
node $id="167772163" twix
primitive res-drbd-store ocf:linbit:drbd \
params drbd_resource="store"
ms ms-drbd-store res-drbd-store \
meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
property $id="cib-bootstrap-options" \
dc-version="1.1.10-42f2063" \
cluster-infrastructure="corosync" \
stonith-enabled="false" \
default-action-timeout="240" \
last-lrm-refresh="1426850488"
#vim:set syntax=pcmk
filesystem mounten
node $id="167772162" raider
node $id="167772163" twix
primitive res-drbd-store ocf:linbit:drbd \
params drbd_resource="store"
ms ms-drbd-store res-drbd-store \
meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
primitive res-fs-store ocf:heartbeat:Filesystem \
params device="/dev/drbd0" directory="/store" fstype="ext4"
colocation c-export-on-drbd inf: res-fs-store ms-drbd-store:Master
order o_drbd_before_nfs inf: ms-drbd-store:promote res-fs-store:start
property $id="cib-bootstrap-options" \
dc-version="1.1.10-42f2063" \
cluster-infrastructure="corosync" \
stonith-enabled="false" \
default-action-timeout="240" \
last-lrm-refresh="1426850488"
#vim:set syntax=pc
create /etc/exports
- root@twix:/etc# cat /etc/exports
/store 192.168.240.0/21(rw,async,no_root_squash,no_subtree_check)
- root@raider:/etc# cat /etc/exports
/store 192.168.240.0/21(rw,async,no_root_squash,no_subtree_check)
NFS Server
Installation
apt-get install nfs-kernel-server
disable drbd autostart
- root@twix:~# update-rc.d nfs-kernel-server disable
- root@raider:~# update-rc.d nfs-kernel-server disable
start nfs-server via corosync
node $id="167772162" raider
node $id="167772163" twix
primitive res-drbd-store ocf:linbit:drbd \
params drbd_resource="store"
primitive res-fs-store ocf:heartbeat:Filesystem \
params device="/dev/drbd0" directory="/store" fstype="ext4"
primitive res-nfs-kernel-server lsb:nfs-kernel-server \
op monitor interval="30s"
ms ms-drbd-store res-drbd-store \
meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
colocation c-export-on-drbd inf: res-fs-store ms-drbd-store:Master res-nfs-kernel-server
order o_drbd_before_nfs inf: ms-drbd-store:promote res-fs-store:start res-nfs-kernel-server:start
property $id="cib-bootstrap-options" \
dc-version="1.1.10-42f2063" \
cluster-infrastructure="corosync" \
stonith-enabled="false" \
default-action-timeout="240" \
last-lrm-refresh="1426850488"
start nfs-server via corosync
node $id="167772162" raider
node $id="167772163" twix
primitive res-drbd-store ocf:linbit:drbd \
params drbd_resource="store"
primitive res-fs-store ocf:heartbeat:Filesystem \
params device="/dev/drbd0" directory="/store" fstype="ext4"
primitive res-nfs-kernel-server lsb:nfs-kernel-server \
op monitor interval="30s"
ms ms-drbd-store res-drbd-store \
meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
colocation c-export-on-drbd inf: res-fs-store ms-drbd-store:Master res-nfs-kernel-server
order o_drbd_before_nfs inf: ms-drbd-store:promote res-fs-store:start res-nfs-kernel-server:start
property $id="cib-bootstrap-options" \
dc-version="1.1.10-42f2063" \
cluster-infrastructure="corosync" \
stonith-enabled="false" \
default-action-timeout="240" \
last-lrm-refresh="1426850488"
links