lvs:environment_2013_01_24
lvs構築 ~2013/01/24~
- その他のライブラリインストール
# yum -y install openssl-devel
- ダウンロード
# cd /usr/src/redhat/SOURCES/ # wget http://www.keepalived.org/software/keepalived-1.2.7.tar.gz
- 解凍
# tar xzvf keepalived-1.2.7.tar.gz # cd keepalived-1.2.7
- specファイル編集
# vi keepalived.spec -) #Version: 1.2.2 +) Version: 1.2.7
- configure
# ./configure
- rpmbuild
# rpmbuild -ba keepalived.spec
- インストール
# cd /usr/src/redhat/RPMS/x86_64/ # rpm -ivh keepalived-1.2.7-5.x86_64.rpm # rpm -qs keepalived
- 設定
# cp /etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf.org # vi /etc/keepalived/keepalived.conf
! Configuration File for keepalived global_defs { notification_email { sendmail@mail.com } notification_email_from keepalived@mail.com smtp_server localhost smtp_connect_timeout 30 router_id LVS_DEVEL } vrrp_instance VI_MYSQL { state BACKUP interface eth0 virtual_router_id 51 priority 100 nopreemt advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.26.199 } } virtual_server 127.0.0.1 3306 { delay_loop 5 lb_algo rr lb_kind DR protocol TCP real_server 192.168.26.146 3306 { weight 10 TCP_CHECK { connect_port 3306 connect_timeout 30 } notify_down "/etc/keepalived/shutdown.sh" } }
# vi /etc/keepalived/shutdown.sh
#!/bin/bash QUERY="show status;" sleep 5 mysqlans=`mysql -uroot -ppass -h 127.0.0.1 -e$QUERY | grep Bytes_received ` if [ "" = "$mysqlans" ]; then /etc/rc.d/init.d/mysqld stop /etc/rc.d/init.d/keepalived stop fi
# chmod 755 /etc/keepalived/shutdown.sh
# /etc/init.d/keepalived start # ip addr show
lvs/environment_2013_01_24.txt · 最終更新: 2014/02/26 03:13 by clownclown