MySQL之-CentOS6.5_x64安裝設定drbd8.4.2
一、主機資源:
************************* *******************
DRBD下載網址:http://oss.linbit.com/drbd/
*********** *********************************
二、系統基本配置
master、 slave都做如下設定。
1.設定/etc/hosts檔案
~]# vi /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.0.152 master 192.168.0.153 slave
2.停用selinux:
# sed -i "7s/enforcing/disabled/" /etc/selinux/config
3.停用或卸載iptables,這裡我們將iptablesservice:
3.停用或卸載iptables,這裡我們將iptablesservice:
1) 關閉stop
2)啟動防火牆-----service iptables start
3)重啟防火牆-----service iptables restart
4) 查看防火牆狀態--service iptables status
5) 永久關閉防火牆--chkconfig iptables off
4.運行yum update升級核心:
# yum update Loaded plugins: fastestmirror, presto Loading mirror speeds from cached hostfile * base: mirrors.btte.NET ………
5.格式化/dev/sdb
#fdisk -l
#fdisk /dev/sdb
6.重啟r.主備節點配置相同)
1.主備節點安裝drbd編譯環境:
reboot
2.下載DRBD安裝檔
# wget http://oss.linbit.com/drbd/8.4/drbd-8.4.2 .tar.gz
3.解壓縮並安裝DRBD檔案
# yum -y install gcc flex wget make kernel-devel kernel-headers Git libxslt rpm-build automake autoconf
4.安裝設定DRBD驅動模組
#tar -zvxf drbd-8.4.2.tar.gz # cd drbd-8.4.2 drbd-8.4.2]# ./configure --prefix=/usr/local/drbd --with-km drbd-8.4.2]# make KDIR=/usr/src/kernels/`uname -r`/ drbd-8.4.2]# make install
四、定義DRBD 設定檔 (主備節點配置相同)
drbd-8.4.2]# cd drbd drbd-8.4.2]# make clean drbd-8.4.2]# make KDIR=/usr/src/kernels/`uname -r`/ drbd-8.4.2]# cp drbd.ko /lib/modules/`uname -r`/kernel/lib/ drbd-8.4.2]# depmod #创建模块依赖关系的列表 drbd-8.4.2]# cp /usr/local/drbd/etc/rc.d/init.d/drbd /etc/rc.d/init.d/ drbd-8.4.2]# chkconfig --add drbd drbd-8.4.2]# chkconfig drbd on
~]# cp /usr/local/drbd/etc/drbd.d/global_common.conf /usr/local/drbd/etc/drbd.d/global_common-bak.conf ~]# vi /usr/local/drbd/etc/drbd.d/global_common.conf
global { usage-count yes; # 是否参加DRBD使用者统计.默认是yes # minor-count dialog-refresh disable-ip-verification } common { handlers { pri-on-incon-degr "/usr/lib/drbd/notify-pri-on-incon-degr.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f"; pri-lost-after-sb "/usr/lib/drbd/notify-pri-lost-after-sb.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b > /proc/sysrq-trigger ; reboot -f"; local-io-error "/usr/lib/drbd/notify-io-error.sh; /usr/lib/drbd/notify-emergency-shutdown.sh; echo o > /proc/sysrq-trigger ; halt -f"; } startup { wfc-timeout 30; degr-wfc-timeout 30; outdated-wfc-timeout 30; } options { # cpu-mask on-no-data-accessible } disk { on-io-error detach; fencing resource-and-stonith; resync-rate 50M; # 设置主备节点同步时的网络速率最大值,单位是字节. } net { protocol C; # 使用协议C.表示收到远程主机的写入确认后,则认为写入完成. cram-hmac-alg sha1; # 设置主备机之间通信使用的信息算法. shared-secret "123456"; } }
~]# vi /usr/local/drbd/etc/drbd.d/Redis.res
resource redis{ on master { device /dev/drbd1; #逻辑设备的路径 disk /dev/sdb; #物理设备 address 192.168.0.152:7788; #IP和监听端口 meta-disk internal; } on slave { device /dev/drbd1; disk /dev/sdb; address 192.168.0.153:7788; meta-disk internal; }
~]# modprobe drbd #载入DRBD模块 ~]# lsmod |grep drbd #确认DRBD模块载入成功