标签:drbd
很粗糙的一个脚本,慢慢会进步的! #!/bin/bash SSH="ssh server" for A in {1..2};do $SSH$A "wget http://oss.linbit.com/drbd/8.4/drbd-8.4.6.tar.gz" E=‘echo $?‘ if [ E -eq 0 ];then $SSH$A "cd /root;wget http://oss.linbit.com/drbd/8.4/drbd-8.4.6.tar.gz; wget http://oss.linbit.com/drbd/drbd-utils-8.9.3.tar.gz; tar xf drbd-8.4.6.tar.gz;cd drbd-8.4.6; tar -xf drbd-utils-8.9.3.tar.gz;cd cd drbd-8.4.6; make KDIR=/usr/src/kernels/2.6.32-573.22.1.el6.x86_64/; make install;cd /root/drbd-utils-8.9.3; ./configure --prefix=/usr/local/drbd --without-83support;make;make install; cp /usr/local/drbd/etc/rc.d/init.d/drbd /etc/rc.d/init.d/;modprobe drbd; chkconfig --add drbd;chkconfig --level2345 drbd on;ln -s /usr/local/drbd/sbin/* /usr/bin/"; else $SSH$A "yum -y install wget;cd /root;wget http://oss.linbit.com/drbd/8.4/drbd-8.4.6.tar.gz; wget http://oss.linbit.com/drbd/drbd-utils-8.9.3.tar.gz; tar xf drbd-8.4.6.tar.gz;tar -xf drbd-utils-8.9.3.tar.gz; cd /root/drbd-8.4.6;make KDIR=/usr/src/kernels/2.6.32-573.22.1.el6.x86_64/; make install;cd /root/drbd-utils-8.9.3; ./configure --prefix=/usr/local/drbd --without-83support;make;make install; cp /usr/local/drbd/etc/rc.d/init.d/drbd /etc/rc.d/init.d/;modprobe drbd; chkconfig --add drbd;chkconfig --level2345 drbd on;ln -s /usr/local/drbd/sbin/* /usr/bin/"; fi D=‘echo $?‘ if [ D -eq 0 ];then $SSH$A "sed -i ‘ s/^#pri-on-incon-degr/pri-on-incon-degr/‘ /etc/drbd.d/global_common.conf; sed -i ‘s/^#pri-lost-after-sb/pri-lost-after-sb/‘ /etc/drbd.d/global_common.conf; sed -i ‘s/^#local-io-error/local-io-error/‘ /etc/drbd.d/global_common.conf; sed -i ‘/#fencing[ ]resource-only/a on-io-error detach‘ /etc/drbd.d/global_common.conf; sed -i ‘/net[ ]{/a cram-hmac-alg "sha1";\nshared-secret "mydrbdlab";‘ /etc/drbd.d/global_common.conf"; fi for H in {1..2};do $SSH$H ‘touch /root/leamon.res‘; J="echo $?" if [ $J -eq 0 ];then echo "resource leamon { on server1.com.cn { device /dev/drbd0; disk /dev/sdb1; address 10.11.22.155:7789; meta-disk internal; } on server2.com.cn { device /dev/drbd0; disk /dev/sdb1; address 10.11.22.59:7789; meta-disk internal; } }" > /root/leamon.res; fi done for I in {1..2};do $SSH$I ‘ echo "n p 1 +2G w" | fdisk /dev/sdb‘; done for K in {1..2};do $SSH$k "drbdadm create-md leamon;/etc/init.d/drbd start"; done done
标签:drbd
原文地址:http://leamonzhang.blog.51cto.com/11334931/1761332