标签:
Nginx+Keepalived负载均衡高可用(双机热备)use epoll;}
worker_connections 51200;
include mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr-$remote_user[$time_local]"$request"‘
‘$status$body_bytes_sent"$http_referer"‘
‘"$http_user_agent""$http_x_forwarded_for"‘;
access_log /usr/local/nginx/logs/access.log main;
sendfile on;
keepalive_timeout 65;
client_header_buffer_size 32k;
large_client_header_buffers 432k;
client_max_body_size 10m;
gzip on;
gzip_min_length 1k;
gzip_buffers 416k;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_disable "MSIE[1-6]\.";
gzip_vary on;
gzip_types text/plainapplication/x-javascripttext/cssapplication/xml;
upstreambackend{#ip_hash; #测试的时候,先注释掉server192.168.10.13:80;server192.168.10.14:80;}
server{}listen 80;server_name localhost;location/{proxy_redirect off;proxy_set_header Host$host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For$proxy_add_x_forwarded_for;proxy_pass http://backend;}}
notification_email{}1244918797@qq.com}
notification_email_fromtest@baba.io
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_idLVS_DEVEL
state BACKUP}
interface eth0
virtual_router_id 100
priority 200
advert_int 1
nopreempt
authentication{auth_type PASSauth_pass 123456}
virtual_ipaddress{192.168.10.50}
notification_email{}1244918797@qq.com}
notification_email_fromtest@baba.io
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
state BACKUP}
interface eth0
virtual_router_id 100
priority 200
advert_int 1
nopreempt
authentication{auth_type PASSauth_pass 123456}
virtual_ipaddress{192.168.10.50}
nginxcheck=`ps-Cnginx--no-header|wc-l`done
keepalivedcheck=`ps-Ckeepalived--no-header|wc-l`
if[$nginxcheck-eq0];thenif[$keepalivedcheck-ne0];then/etc/init.d/keepalivedstopelseecho "keepalivedisstoped"fielif[$keepalivedcheck-eq0];then/etc/init.d/keepalivedstartfi
sleep 5
标签:
原文地址:http://blog.csdn.net/pa5201314/article/details/45042187