DRBD配置
1.配置要求
server4:172.25.13.4
server5:172.25.13.5
软件包:drbd-8.4.3.tar.gz
下载地址:http://oss.linbit.com/drbd/
yum install gcc -y
yum install rpm-build -y
yum install kernel-devel -y
yum install flex -y
2.软件安装
[server4]
tar zxf drbd-8.4.3.tar.gz
cd drbd-8.4.3
./configure --enable-spec --with-km
rpmbuild -bb drbd.spec ##制作rpm包
rpmbuild -bb drbd-km.spec ##制作drbd-km包
rpm -ivh ../rpmbuild/RPMS/x86_64/* ##装上所有的包,一共8个
将../rpmbuild/RPMS/x86_64/下的包复制到server5上面装上
[server4][server5]
#vim /etc/drbd.d/drbd.res ##添加资源文件
resource example {meta-disk internal; ##内部device /dev/drbd1; ##建立出来的磁盘名syncer {verify-alg sha1;##合并方式}on server4 { ##主机4disk /dev/vdb; ##磁盘和端口address 172.25.13.4:7789;}on server5 {disk /dev/vdb;address 172.25.13.5:7789;}
}
[server4][server5]
drbdadm create-md example ##初始化
/etc/init.d/drbd start ##启动
[server4]
drbdsetup /dev/drbd1 primary --force ##首次转移使用权
watch -n 1 cat /proc/drbd
mkfs.ext4 /dev/drbd1
mount /dev/drbd1 /mnt/
cp /etc/*.conf /mnt
umount /mnt/
drbdadm secondary example
[server5]
drbdadm primary example
mount /dev/drbd1 /mnt/
ls /mnt/
heartbeat的基本配置:http://blog.csdn.net/rangewudi/article/details/72822581
heartbeat+mysql+drbd高可用
[server4][server5]
yum install mysql-server ##这里的mysql仅仅测试
drbdadm secondary example
echo 'server4 IPaddr::172.25.13.100/24/eth0 drbddisk::example Filesystem::/dev/drbd1::/var/lib/mysql::ext4 mysqld' >/etc/ha.d/haresources
/etc/init.d/heartbeat start
注意/var/lib/mysql/的uid=mysql gid=mysql