nginx 负载均衡web查看状态nginx_upstream_check_module
2013-11-08 12:09
1111 查看
nginx 负载均衡web查看状态nginx_upstream_check_module最近在做nginx负载均衡的时候发现nginx本身没有界面的管理工具,也没有发现其他的文本的管理工具。希望知道的朋友可以留言告诉我. 发现taobao在开源了自己的nginx 定制版本里面,有一个模块(nginx_upstream_check_module),这个模块就是用来查看nginx 负载均衡时候的realserver的状态的. 经过实验已经成功加入nginx 再此做个记录和分享。lnmp 环境的安装请参照我的生产环境的lnmp 的安装,在安装nginx的时候参照下面的安装:http://renzhenxing.blog.51cto.com/blog/728846/1321572下载nginx_upstream_check_module:
cd /usr/local/src/ wget https://github.com/yaoweibin/nginx_upstream_check_module/archive/master.zip unzip master.zip安装nginx的支持:pcre
tar-zxvf pcre-8.21.tar.gz cd pcre-8.21 ./configure && make && makeinstall安装nginx-1.3.0
tar -zxvf nginx-1.3.0.tar.gz cd nginx-1.3.0给nginx打上
nginx_upstream_check_module-master的包(注:因nginx版本更新,1.2以上版本的nginx,补丁为check_1.2.1+.patch)
patch -p1 < /usr/local/src/nginx_upstream_check_module-master/check_1.2.1.patch开始编译安装nginx:### 注意下面的--with-pcre=pcre的安装包路径千万不要搞错了。
./configure --user=www --group=www --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.21 --lock-path=/var/run/nginx.lock --pid-path=/var/run/nginx.pid --add-module=/usr/local/src/nginx_upstream_check_module-master
make && make install添加nginx配置:因为篇幅大小原因,这个配置文件是省略了部分常用内容,但是并不代表其他不需要.(以下为需要特别注意的地方)
upstream www { #ip_hash; server 192.168.100.11:80; #多个realserver服务器在此添加 server 192.168.100.12:80; check interval=3000 rise=2 fall=5 timeout=1000; } server { listen 80; server_name www.etiantian.org; #charset koi8-r; access_log logs/host.access.log main; root /data0/www; location / { proxy_pass http://www; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /status { check_status; access_log off; #allow SOME.IP.ADD.RESS; #deny all; } }
※ 附件会发上来我的nginx 配置文件,希望对大家有帮助.
1 upstream 后面的www不是域名.可以根据需要自己起。
2 [code]upstream 后面的www 要和proxy_pass http://www; 里面的www相互对应.
3 注解:check interval=3000 rise=2 fall=5 timeout=1000;
interval检测间隔时间,单位为毫秒。
rsie请求2次正常的话,标记此realserver的状态为up。
fall表示请求5次都失败的情况下,标记此realserver的状态为down。
timeout为超时时间,单位为毫秒。测试nginx:
/usr/local/nginx/sbin/nginx -tnginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful启动nginx:
/usr/local/nginx/sbin/nginx &测试截图:
相关文章推荐
- nginx 负载均衡web查看状态nginx_upstream_check_module
- 安装nginx,配置负载均衡和添加状态监测的nginx_upstream_check_module模块
- Nginx 负载均衡 后端 监控检测 nginx_upstream_check_module 模块的使用
- Nginx 负载均衡 后端 监控检测 nginx_upstream_check_module 模块的使用
- 如何利用nginx_upstream_check_module-master对nginx的后端机器进行健康状态检查
- nginx_upstream_check_module-master对nginx的后端机器进行健康状态检查报403错误【转】
- 高性能Web服务器Nginx的配置与部署研究(15)Upstream负载均衡模块
- 安装nginx_upstream_check_module时make出错,求助
- nginx利用第三方模块nginx_upstream_check_module来检查后端服务器的健康情况
- nginx利用第三方模块nginx_upstream_check_module来检查后端服务器的健康情况
- nginx_upstream_check_module监控后端服务器http
- Nginx_http_upstream_check_module应用
- nginx入门学习—— 在已安装好的nginx上添加nginx_upstream_check_module模块(三)
- nginx下后端realserver健康检测模块ngx_http_upstream_check_module
- nginx利用第三方模块nginx_upstream_check_module来检查后端服务器的健康情况
- nginx利用第三方模块nginx_upstream_check_module来检查后端服务器的健康情况
- nginx_upstream_check_module(原文)
- Nginx容器动态流量管理方案-nginx-upsync-module+nginx_upstream_check_module初体验
- Nginx 负载均衡模块 ngx_http_upstream_module 详述
- nginx利用第三方模块nginx_upstream_check_module来检查后端服务器的健康情况