Init DRBD
Both Nodes
cat << EOL >/etc/drbd.d/varwww.res resource varwww { meta-disk internal; disk /dev/sdb2; device /dev/drbd2; on node1 { address 192.168.1.1:7789; } on node2 { address 192.168.1.2:7789; } } EOL
drbdadm create-md varwww modprobe drbd drbdadm up all
Node1
drbdadm primary --force varwww watch cat /proc/drbd
Both Nodes
mkfs.ext4 /dev/drbd2 umount /mnt mount /dev/drbd2 /mnt df -h | grep drbd
umount /mnt mount /dev/drbd2 /mnt df -h | grep drbd
I-O Error Fix
You want to be able to mount - unmount and remount the DRBD to know its working, I find I get an I-O Error 2nd remount and drbdadm up fixes it
drbdadm up varwww watch cat /proc/drbd
umount /mnt mount /dev/drbd2 /mnt df -h | grep drbd
After Successfully Mounting & Unmounting & Remounting - Unmount on Both
umount /mnt
Migrate Web-Data
Both Nodes
systemctl disable httpd.service service httpd stop
cat <<-END >/etc/httpd/conf.d/status.conf <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 </Location> END
Node1
mount /dev/drbd2 /mnt df -h | grep drbd mv /var/www/* /mnt umount /mnt
Node2
rm /var/www/* -R