nginx nginx_upstream_check_module自动踢除后端机器
nginx 1.14.0
描述:
nginx自带的upstream配置,如果后端挂了,接口会慢,原因不讲述,故接入第三方的自动检测与自动踢除模式
nginx_upstream_check_module模块:
*** 下载地址https://github.com/yaoweibin/nginx_upstream_check_module ***
wget 'http://nginx.org/download/nginx-1.14.0.tar.gz'
tar -xzvf nginx-1.14.0.tar.gz
cd nginx-1.14.0/
patch -p1 < /path/to/nginx_http_upstream_check_module/check_1.14.0+.patch
#./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=/opt/tools/openssl-1.0.2l/ --with-pcre-jit --with-ld-opt=-ljemalloc --with-debug --add-module=/opt/tools/nginx-module-vts-master/ --add-module=/opt/tools/nginx_upstream_check_module-master/ --add-module=/opt/tools/ngx_cache_purge-2.3/
#make
#mv objs/nginx /usr/local/nginx/sbin/nginx
#nginx -s reload
nginx配置例子
http {
upstream cluster {
# simple round-robin
server 192.168.0.1:80;
server 192.168.0.2:80;
check interval=5000 rise=1 fall=3 timeout=4000;
#check interval=3000 rise=2 fall=5 timeout=1000 type=ssl_hello;
#check interval=3000 rise=2 fall=5 timeout=1000 type=http;
#check_http_send "HEAD / HTTP/1.0\r\n\r\n";
#check_http_expect_alive http_2xx http_3xx;
}
server {
listen 80;
location / {
proxy_pass http://cluster;
}
location /check_status {
check_status;
access_log off;
allow SOME.IP.ADD.RESS;
deny all;
}
}
}
curl http://qing.xxxx/check_status?format=json
nginx nginx_upstream_check_module自动踢除后端机器的更多相关文章
- 使用Keepalived实现Nginx的自动重启及双主热备高可用
1.概述 之前我们使用Keepalived实现了Nginx服务的双机主备高可用,但是有几个问题没有解决,今天一起探讨一下. 1)在双机主备机制中,Keepalived服务如果宕了,会自动启用备机进行服 ...
- nginx url自动加斜杠的问题
nginx url自动加斜杠问题及301重定向 时间:2016-02-04 15:14:28来源:网络 导读:nginx url自动加斜杠问题及301重定向,URL指向一个目录并且在最后没有包含斜杠, ...
- Nginx负载均衡反向代理 后端Nginx获取客户端真实IP
Nginx 反向代理后,后端Nginx服务器无法正常获取客户端的真实IP nginx通过http_realip_module模块来实现的这需要重新编译,如果提前编译好了就无需重新编译了1,重新编译ng ...
- nginx tomcat 自动部署python脚本【转】
#!/usr/bin/env python #--coding:utf8-- import sys,subprocess,os,datetime,paramiko,re local_path='/ho ...
- 使用nginx反向代理处理前后端跨域访问
本文主要解决:使用nginx反向代理处理前后端跨域访问的问题 1.何为跨域访问? 以下类型为跨域访问 1)不同域名间访问 www.zuiyoujie.com和www.baidu.com 2)同域名不同 ...
- nginx解决跨域(前后端分离)
Nginx解决跨域问题 后端接口 请求地址 返回数据(json数据) http://127.0.0.1:8080//app Hello World! 前端代码 通过nginx做静态资源服务器访问端口8 ...
- Consul-template+nginx实现自动负载均衡
前言 consul-template 是 Consul 的一个守护程序,使用 consul-template 可以方便快速的实现对 Consul Key/Value 存储系统的访问,可以从 KV 系统 ...
- 15、基于consul+consul-template+registrator+nginx实现自动服务发现
一.架构图 二.组件介绍 1.Registrator Registrator:一个由Go语言编写的,针对docker使用的,通过检查本机容器进程在线或者停止运行状态,去注册服务的工具.所以我们要做的实 ...
- nginx脚本自动安装
nginx脚本自动安装 脚本功能: 自动安装nginx 自动判别系统是否安装nginx 自定义安装nginx路径 自定义安装nginx版本. #!/bin/bash #2019年10月30日16:00 ...
随机推荐
- C# - WinFrm应用程序调用SharpZipLib实现文件的压缩和解压缩
前言 本篇主要记录:VS2019 WinFrm桌面应用程序调用SharpZipLib,实现文件的简单压缩和解压缩功能. SharpZipLib 开源地址戳这里. 准备工作 搭建WinFrm前台界面 添 ...
- [转]使用IConfigureNamedOptions和ConfigureAll配置命名选项
这是我上一篇关于在ASP.NET Core 2.x中使用多个强类型设置实例的后续文章.在文章的结尾,我介绍了命名选项的概念,该选项已添加到ASP.NET Core 2.0中.在本文中,我将详细介绍如何 ...
- Python - ^在正则表达式中的作用
^在正则表达式中有两个作用,一是表达以什么开头,二是表达对什么取反.有时候经常傻傻的分不清楚,接下来给大家详细介绍该怎么用这个^准备一个python文件test.py,借用re.search函数举例说 ...
- 机器学习常见的几种评价指标:精确率(Precision)、召回率(Recall)、F值(F-measure)、ROC曲线、AUC、准确率(Accuracy)
原文链接:https://blog.csdn.net/weixin_42518879/article/details/83959319 主要内容:机器学习中常见的几种评价指标,它们各自的含义和计算(注 ...
- go-客户信息关系系统
客户信息关系系统 项目需求分析 1) 模拟实现基于文本界面的< 客户信息管理软件>. 2) 该软件能够实现对客户对象的插入.修改和删除(用切片实现),并能够打印客户明细表 项目的界面设计 ...
- toUpperCase(),toLowerCase()将字符串中的英文转换为全大写或全小写
package seday01;/** * String toUpperCase() * String toLowerCase() * 将字符串中的英文转换为全大写或全小写 * @author xin ...
- JavaScript 错误异常
JavaScript 错误异常 错误异常语句 try 语句测试代码块中的错误 catch 语句处理错误 throw 语句允许自定义错误 finally 语句在错误异常语句后,必须执行的代码块 try ...
- 微服务:Eureka+Zuul+Ribbon+Feign+Hystrix构建微服务架构
原文地址:http://blog.csdn.net/qq_18675693/article/details/53282031 本案例将打架一个微服务框架,参考来源官方参考文档 微服务:是什么?网上有一 ...
- rocksdb和leveldb性能比较——写性能
前面学习了一下rocksdb,这个db是对leveldb的一个改进,是基于leveldb1.5的版本上的改进,而且leveldb1.5以后也在不断的优化,下面从写入性能对两者进行对比. 前言 比较的l ...
- docker安装执行问题
ubuntu14.04上安装docker问题: sudo apt-get update curl -fsSL https://get.docker.com -o get-docker.sh sh ge ...