Installing DRBD
Yum install GCC flex rpm-build kernel-devel-yrpmbuild ~ #在家目录生成 rpmbuild required path for compiling CP drbd-8.4.0.tar.gz Rpmbuild/sources/tar ZXF drbd-8.4.0.tar.gzcd drbd-8.4.0./configure--enable-spec--with-kmrpmbuild-bb drbd.spec# compilation generate DRBD RPM package RPMBUILD-BB D Rbd-km.spec #编译 DRBD Kernel module CD ~/RPMBUILD/RPMS/X86_64RPM-IVH * Copy the generated RPM package to another host and install the package: SCP ~/rpmbuild/rpms/x86_64/* 192.168.0.251:/root
2. Configure the Drbd.res file/ETC/DRBD/DRBD.
resresource mysqldata { meta-disk internal; device /dev/drbd1; syncer { verify-alg sha1; }on demo {        DISK /DEV/VDB; /DRBD the storage disk to be used address 192.168.122.4:7789;} on remote { disk /vdb; address 192.168.122.5:7789;}} Operations performed by both hosts drbdadm create-md mysqldata/etc/init.d/drbd startcat /proc/drbd You can view the status down on the demo demo set as primary node and synchronize the data: (Execute the following command on the demo host) drbdsetup /dev/ Drbd1 primary --force on two consolesView sync Status: WATCH CAT /PROC/DRBD Create file system after data synchronization: MKFS.EXT4 /DEV/DRBD1 Mount File System:mount /dev/drbd1 /var/lib/mysql then in the HTML the new file will be saved to sync on another server first need to set the demo/dev/drbd1 uninstall demo to secondary drbdadm Secondary mysqldataremote on Executive drbdadm primary mysqldatadrbdadm primary Mysqldatamount /dev/drbd1 /var/lib/mysql can be implemented in synchronous database operation
Simple configuration of DRBD shared storage