Background:
The company's official website PV is not high, the pressure is not big, so the company gives two servers to provide official website Web services, after all, the company façade, can not be a problem! So you need a lightweight web disaster recovery solution!
Scheme:
Using Keepalived+nginx to realize the high availability of website web
Two servers a main, one for the standby machine, so that two machines common a virtual IP, when the main server down, 106.3.32.6 this IP will automatically switch to the standby, the front-end machine after the resumption of automatic switching back to the main service machine
Then, the main server and the standby machine use rsync to realize real-time synchronization data,
The installation configuration of rsync can refer to my previous article: http://cuimk.blog.51cto.com/6649029/1322241
Environment:
CentOS 6.4
nginx-1.2.1
keepalived-1.2.2
First, installation
Both primary and secondary need to install keepalived, same installation method
Yum-y install kernel-devel
yum install openssl-*-y wget
http://www.keepalived.org/software/ keepalived-1.2.2.tar.gz
tar xzf keepalived-1.2.2.tar.gz
cd keepalived-1.2.2
./configure--prefix=/usr/ Local/keepalived make
&& make install
ln-s/usr/src/kernels/2.6.18-238.el5-i686//usr/src/linux
cp/usr/local/keepalived/etc/rc.d/init.d/keepalived/etc/init.d/
Cp/usr/local/keepalived/etc/sysconfig /keepalived/etc/sysconfig/
mkdir-pv/etc/keepalived
cp/usr/local/keepalived/etc/keepalived/ keepalived.conf/etc/keepalived/
ln-s/usr/local/keepalived/sbin/keepalived/sbin/
Join power-on start: chkconfigkeepalived on