Nginx负载均衡监控节点状态
利用第三方插件監(jiān)控(淘寶開發(fā)的Tengine)
模塊:nginx_upstream_check_module
實(shí)現(xiàn)web界面
?
下載補(bǔ)丁包
wget https://codeload.github.com/yaoweibin/nginx_upstream_check_module/zip/master
解壓縮
unzip master?
drwxr-xr-x 6 root root ? 4096 11月 10 18:58 nginx_upstream_check_module-master
cd nginx-1.6.3
打補(bǔ)丁
patch -p1 <../nginx_upstream_check_module-master/check_1.5.12+.patch
patching file src/http/modules/ngx_http_upstream_ip_hash_module.c
patching file src/http/modules/ngx_http_upstream_least_conn_module.c
patching file src/http/ngx_http_upstream_round_robin.c
patching file src/http/ngx_http_upstream_round_robin.h
重新編譯(最好先備份一下之間的配置文件)
?./configure --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --add-module=../nginx_upstream_check_module-master/
make
(如果新的nginx就makeinstall ? ?如果不是新的nginx,就不用makeinstall了)
把之前nginx啟動(dòng)文件里的文件備份一下
mv /application/nginx/sbin/nginx{,.bak}
將補(bǔ)丁的nginx二進(jìn)制文件復(fù)制到/application/nginx/sbin/
cp ./objs/nginx /application/nginx/sbin/
?/application/nginx/sbin/nginx -t ?
/application/nginx/sbin/nginx -s reload
檢查模塊
/application/nginx/sbin/nginx -V
nginx version: nginx/1.6.3
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --add-module=../nginx_upstream_check_module-master/
?
添加一個(gè)參數(shù)
vim /application/nginx/conf/nginx.conf
在每一個(gè)upstream里添加一行
upstream android_pools {
server 192.168.70.127:80 weight=1; #apache
check interval=3000 rise=2 fall=5 timeout=1000 type=http;
#interval ?3秒檢查
#rise ?宕機(jī)請(qǐng)求2次,好了加進(jìn)來
#fall ? 宕機(jī)壞了 請(qǐng)求5次,還不行提出
#timeout ?超時(shí)一秒
}
?
在server里添加
location /status {
check_status;
access_log off;
}
?
訪問網(wǎng)址
192.168.70.131
Name ?節(jié)點(diǎn)
status ?狀態(tài)
Rise ?宕機(jī)啟動(dòng)次數(shù)
fall 宕機(jī)次數(shù)
check type 檢查類型
check ?prot ?端口
轉(zhuǎn)載于:https://www.cnblogs.com/sky00747/p/8656316.html
總結(jié)
以上是生活随笔為你收集整理的Nginx负载均衡监控节点状态的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: RocketMQ最佳实战
- 下一篇: 前后台数据交互