July 2020
M T W T F S S
« Mar    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

WordPress Quotes

I try to learn from the past, but I plan for the future by focusing exclusively on the present. That's were the fun is.
Donald Trump
July 2020
M T W T F S S
« Mar    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Short Cuts

2012 SERVER (64)
2016 windows (9)
AIX (13)
Amazon (40)
Ansibile (19)
Apache (135)
Asterisk (2)
cassandra (2)
Centos (211)
Centos RHEL 7 (270)
centos8 (3)
chef (3)
cloud (2)
cluster (3)
Coherence (1)
DB2 (5)
DISK (25)
DNS (9)
Docker (30)
Eassy (11)
ELKS (1)
EXCHANGE (3)
Fedora (6)
ftp (5)
GIT (3)
GOD (2)
Grub (1)
Hacking (10)
Hadoop (6)
health (2)
horoscope (23)
Hyper-V (10)
IIS (15)
IPTABLES (15)
JAVA (7)
JBOSS (32)
jenkins (1)
Kubernetes (7)
Ldap (5)
Linux (188)
Linux Commands (166)
Load balancer (5)
mariadb (14)
Mongodb (4)
MQ Server (24)
MYSQL (84)
Nagios (5)
NaturalOil (13)
Nginx (35)
Ngix (1)
openldap (1)
Openstack (6)
Oracle (35)
Perl (3)
Postfix (19)
Postgresql (1)
PowerShell (2)
Python (3)
qmail (36)
Redis (12)
RHCE (28)
SCALEIO (1)
Security on Centos (29)
SFTP (1)
Shell (64)
Solaris (58)
Sql Server 2012 (4)
squid (3)
SSH (10)
SSL (14)
Storage (1)
swap (3)
TIPS on Linux (28)
tomcat (62)
Ubuntu (1)
Uncategorized (30)
Veritas (2)
vfabric (1)
VMware (28)
Weblogic (38)
Websphere (71)
Windows (19)
Windows Software (2)
wordpress (1)
ZIMBRA (17)

WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

Who's Online

0 visitors online now
0 guests, 0 bots, 0 members

Hit Counter provided by dental implants orange county

Nginx load balancing servers are available for dual machines

If the Web server cluster as a city, then the load balancing server is equivalent to the gates, the importance of self-evident.If the “gates” off, and the outside world is broken, if only a balanced server , When the server fails, it will lead to the entire site can not access.Therefore, we need to more than two servers, to achieve a high transition and high availability.

Dual high availability is generally achieved through the virtual IP (drift IP) method, based on Linux / Unix IP alias technology. Dual high-availability method is divided into two types:

(1): a server plus a hot by the server, under normal circumstances, the main server binding a public network virtual IP, to provide load balancing services, hot standby server is idle, when the main server failure, hot standby The server takes over the public network virtual IP of the main server and provides the load balancing service;

(2): two load balancing servers are active, each binding a public network virtual IP, to provide load balancing services, when one of the failure, the other to take over the failure of the public network virtual server IP.
?1?rmohan.com IP 61.1.1.2
?2?61.1.1.4 IP 61.1.1.2

/sbin/ifconfig eth0:1 61.1.1.2 broadcast 61.1.1.255 netmask 255.255.255.0 up
/sbin/route add -host 61.1.1.2 dev eth0:1
/sbin/arping -I eth0 -c 61.1.1.2 61.1.1.1
(3) rmohan.com?IP? 61.1.1.2? 61.1.1.4? 61.1.1.5
?4? 61.1.1.4 61.1.1.5 IP 61.1.1.2?ping MAC?

/sbin/ifconfig etho:1 61.1.1.2 broadcast 61.1.1.255 netmask 255.255.255.0 up
/sbin/ifconfig add -host 61.1.1.2 dev eth0:1
/sbin/arping -I etho -c 3 -s 61.1.1.2 61.1.1.1
(5) rmohan.com(IP) 61.1.1.1?

VRRP Keepalive ?
?1??rmohan.com DNS IP 61.1.1.2 61.1.1.3
?2? IP? 61.1.1.4
/sbin/ifconfig etho:1 61.1.1.2 broadcast 61.1.1.255 netmask 255.255.255.0 up
/sbin/ifconfig add -host 61.1.1.2 dev eth0:1
/sbin/arping -I etho -c 3 -s 61.1.1.2 61.1.1.1 61.1.1.5
/sbin/ifconfig etho:1 61.1.1.3 broadcast 61.1.1.255 netmask 255.255.255.0 up
/sbin/ifconfig add -host 61.1.1.2 dev eth0:1
/sbin/arping -I etho -c 3 -s 61.1.1.3 61.1.1.1
(3) www,linuxidc.com IP 61.1.1.2 61.1.1.3? DNS
(4)IP 61.1.1.2?ARPing IDC MAC ?
/sbin/ifconfig etho:1 61.1.1.2 broadcast 61.1.1.255 netmask 255.255.255.0 up
/sbin/ifconfig add -host 61.1.1.2 dev eth0:1
/sbin/arping -I etho -c 3 -s 61.1.1.2 61.1.1.1

Nginx?

#!/bin/sh
LANG=C
date=$(date -d “today” +”%Y-%m-%d %H?%M:%S”)

function_bind_vip1()
{
/sbin/ifconfig etho:ha1 61.1.1.2 broadcast 219.232.254.255 netmask 255.255.255.192 up
/sbin/route add -host 61.1.1.2 dev eth0:hal
}
function_bind_vip2()
{

/sbin/ifconfig etho:ha2 61.1.1.3 broadcast 219.232.254.255 netmask 255.255.255.192 up
/sbin/route add -host 61.1.1.2 dev eth0:ha2
}
function_restart_nginx()
{
kill -USR1 ‘cat /usr/local/webserver/nginx/nginx.pid’
}
function_remove_vip1()
{
/sbin/ifconfig etho:ha1 61.1.1.2 broadcast 219.232.254.255 netamsk 255.255.255.192 down
}

function_remove_vip2()
{
/sbin/ifconfig etho:ha2 61.1.1.3 broadcast 219.232.254.255 netamsk 255.255.255.192 down
}
function_vip_arping1()
{
/sbin/ifconfig -I eth0 -c 3 -e 611..1.1.2 61.1.1.1 > /dev/null 2>&1
}
function_vip_arping2()
{
/sbin/ifconfig -I eth0 -c 3 -e 611..1.1.3 61.1.1.1 > /dev/null 2>&1
}

bind_time_vip1=”N”;
bind_time_vip2=”N”;

while true
do
httpcode_arp1=’/usr/bin/cur1 -o /dev/null s -w %{http_code} http://61.1.1.4′
httpcode_arp2=’/usr/bin/cur1 -o /dev/null s -w %{http_code} http://61.1.1.5′

if [x$httpcode_rip1 == “x200″];
then
function_bind_vip1
function_vip_arping1
function_restart_nginx
bind_time_vip1=”Y”
fi
function_vip_arping1
else
if [$bind_time_vip1 == “Y”];
then
function_remote_vip1
bind_time_vip=”N”
fi
fi

if [x$httpcode_arp2 == “x200”];
then
if[ $bind_time_vip2 == “Y”]
then
function_rempve_vip2
bind_time_vip2=”N”
fi
else
if[$bind_time_vip2 == “N”];
then
function_bind_vip2
function_vip_arping2
function_restart_nginx
bind_time_vip2=”Y”
fi
function_vip_arping2
fi

sleep 5
done
Nginx
nohup /bin/sh ./nginx_hal.sh 2>&1 > dev/null &
#!/bin/sh
LANG=C
date=$(date -d “today” +”%Y-%m-%d %H?%M:%S”)

function_bind_vip1()
{
/sbin/ifconfig etho:ha1 61.1.1.3 broadcast 219.232.254.255 netmask 255.255.255.192 up
/sbin/route add -host 61.1.1.3 dev eth0:hal
}
function_bind_vip2()
{

/sbin/ifconfig etho:ha2 61.1.1.2 broadcast 219.232.254.255 netmask 255.255.255.192 up
/sbin/route add -host 61.1.1.2 dev eth0:ha2
}
function_restart_nginx()
{
kill -USR1 ‘cat /usr/local/webserver/nginx/nginx.pid’
}
function_remove_vip1()
{
/sbin/ifconfig etho:ha1 61.1.1.3 broadcast 219.232.254.255 netamsk 255.255.255.192 down
}

function_remove_vip2()
{
/sbin/ifconfig etho:ha2 61.1.1.2 broadcast 219.232.254.255 netamsk 255.255.255.192 down
}
function_vip_arping1()
{
/sbin/ifconfig -I eth0 -c 3 -e 61.1.1.3 61.1.1.1 > /dev/null 2>&1
}
function_vip_arping2()
{
/sbin/ifconfig -I eth0 -c 3 -e 61.1.1.2 61.1.1.1 > /dev/null 2>&1
}

bind_time_vip1=”N”;
bind_time_vip2=”N”;

while true
do
httpcode_arp1=’/usr/bin/cur1 -o /dev/null s -w %{http_code} http://61.1.1.5′
httpcode_arp2=’/usr/bin/cur1 -o /dev/null s -w %{http_code} http://61.1.1.4′

if [x$httpcode_rip1 == “x200″];
then
function_bind_vip1
function_vip_arping1
function_restart_nginx
bind_time_vip1=”Y”
fi
function_vip_arping1
else
if [$bind_time_vip1 == “Y”];
then
function_remote_vip1
bind_time_vip=”N”
fi
fi

if [x$httpcode_arp2 == “x200”];
then
if[ $bind_time_vip2 == “Y”]
then
function_rempve_vip2
bind_time_vip2=”N”
fi
else
if [$bind_time_vip2 == “N”];
then
function_bind_vip2
function_vip_arping2
function_restart_nginx
bind_time_vip2=”Y”
fi
function_vip_arping2
fi

sleep 5
done

nohup /bin/sh ./nginx_ha2.sh 2>&1 > dev/null &

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

Blue Captcha Image
Refresh

*

Protected by WP Anti Spam