cuiyadll 2013-07-28
监控Nginx负载均衡器脚本
1.编写脚本
vim nginx_pid.sh 
#!/bin/bash 
while  : 
do
nginxpid=`ps -C nginx --no-header | wc -l` 
if [ $nginxpid -eq 0 ];then
/usr/local/nginx/sbin/nginx
sleep 5 
  if [ $nginxpid -eq 0 ];then
  /etc/init.d/keepalived stop 
  fi
fi
sleep 5 
done
:wq
2.执行脚本
sh /root/nginx_pid.sh & 
nohup /bin/bash /root/nginx_pid.sh &
推荐阅读:
当服务器节点数据增长到20个或更多时,负载均衡器将成为整个系统的瓶颈,因为所有的请求包和应答包都需要经过负载。采用VS-NAT的负载均衡器。为超过100台的物理服务器服务,负载均衡器不再是系统的瓶颈。