Haproxy 代理
一:安装haproxy
1:解压 编译 安装
tar zxf haproxy-1.7.9.tar.gz
cd haproxy-1.7.9
uname -e
make TARGET=linux2.6 PREFIX=/usr/local/haproxy
make install PREFIX=/usr/local/haproxy
二:创建haproxy配置文件
mkdir /etc/haproxy
cd /etc/haproxy/
vi haproxy.cfg
########################
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
user www
group www
daemon
nbproc 8
defaults
log global
mode tcp
option tcplog
option dontlognull
retries 3
option redispatch
maxconn 2000
timeout connect 50000
timeout client 50000
timeout server 50000
#Ha代理192.168.6.140 22端口
listen sshd
bind 0.0.0.0:11000
server 140_ssh 192.168.6.140:22 check inter 2000 rise 2 fall 5
#Ha代理http
listen 192.168.6.140_tomcat
bind 0.0.0.0:11001
mode http
balance roundrobin
server web1 192.168.6.140:8080 weight 1 maxconn 10000 check inter 3s rise 3 fall 3
# Ha代理redis
listen redis
bind 0.0.0.0:9999
balance leastconn
mode tcp
# redis 健康检查,确保只有master提供连接
option tcp-check
tcp-check connect
tcp-check send PING\r\n
tcp-check expect string +PONG
tcp-check send info\ replication\r\n
tcp-check expect string role:master
tcp-check send QUIT\r\n
tcp-check expect string +OK
server redis01 127.0.0.1:6380 check port 6380 inter 5s fastinter 2s downinter 5s rise 3 fall 3
server redis02 127.0.0.1:6381 check port 6381 inter 5s fastinter 2s downinter 5s rise 3 fall 3
# Ha web页面配置
listen status
bind *:10000
mode http
stats enable
stats uri /status
stats refresh 5s
stats show-node
stats show-legends
stats hide-version
bind-process 2
三:配置haproxy启动脚本
cp /haproxy-1.7.9/examples/haproxy.init /etc/init.d/haproxy
cp /usr/local/haproxy/sbin/haproxy /usr/sbin/
chmod a+x /etc/init.d/haproxy
四:启动haproxy服务
/usr/local/haproxy/sbin/haproxy -f /etc/haproxy/haproxy.cfg
或
/etc/init.d/haproxy start
Haproxy 代理的更多相关文章
- 利用HAProxy代理SQL Server的AlwaysOn辅助副本
利用HAProxy代理SQL Server的AlwaysOn辅助副本 公司最近数据库升级到SQL Server2014 ,并部署了alwayson高可用集群 机房内有三套程序需要读取数据库 第一套:主 ...
- haproxy(8):haproxy代理MySQL要考虑的问题
HaProxy系列文章:http://www.cnblogs.com/f-ck-need-u/p/7576137.html haproxy可以通过 TCP协议 来代理MySQL.但是两个问题必须考虑: ...
- haproxy代理https配置方法【转】
记得在之前的一篇文章中介绍了nginx反向代理https的方法,今天这里介绍下haproxy代理https的方法: haproxy代理https有两种方式:1)haproxy服务器本身提供ssl证书, ...
- [ Mariadb ] 通过HAProxy代理后端Mariadb实现负载均衡
一.本次环境架构图 由于公司内网服务器有限,所以后端采用Mariadb自带的mysql_multi模型实现多实例. mysql的多实例有两种方式可以实现,两种方式各有利弊. 1.使用多个配置文件启动不 ...
- haproxy代理kibana、nginx代理kibana并实现登录验证
在使用ELK进行日志统计的时候,由于Kibana自身并没有身份验证的功能,任何人只要知道链接地址就可以正常登录到Kibana控制界面,由于日常的查询,添加和删除日志都是在同一个web中进行,这样就有极 ...
- 使用Haproxy代理rabbitmq集群,用keepalive保证haproxy高可用
原文地址:https://www.jianshu.com/p/440b8e1d5339 使用Haproxy代理rabbitmq集群 上一篇文章教了rabbitmq集群搭建.但是这样搭建出来的集群是3个 ...
- [原]HAproxy 代理技术原理探究
HAproxy 技术分享 简介 HAProxy是一款提供高可用性.负载均衡以及基于TCP(第四层)和HTTP(第七层)应用的代理软件 Features 1.免费 2.能够做到4层以上代理 3.高性能 ...
- HAProxy 代理负载均衡
HAProxy HAProxy是免费 高效 可靠的高可用及负载均衡解决方案,该软件非常适合于处理高负载站点的七层数据请求,HAProxy的工作模式使其可以非常容易且安全地集成到我们现有的站点架构中.使 ...
- haproxy代理配置段参数设定
代理配置段:有四个配置段 default:设定默认参数, frontenf:前端服务器的设定 backend:后端服务器的设定 listening:是设定前端和后端一一对应的设定 参数: 1bind: ...
- HAproxy 代理技术原理探究
HAproxy 技术分享 简介 HAProxy是一款提供高可用性.负载均衡以及基于TCP(第四层)和HTTP(第七层)应用的代理软件 Features 1.免费 2.能够做到4层以上代理 3.高性能 ...
随机推荐
- Linux查看系统开机和关机时间
1.who 命令查看 who -b 查看最后一次系统启动的时间 who -r 查看当前系统运行时间 [root@test ~]# who -b system ...
- Centos7 初始化
systemctl disable firewalld sed -ri '/^[^#]*SELINUX=/s#=.+$#=disabled#' /etc/selinux/config grubby - ...
- Django学习系列15:把POST请求中的数据存入数据库
要修改针对首页中的POST请求的测试.希望视图把新添加的待办事项存入数据库,而不是直接传给响应. 为了测试这个操作,要在现有的测试方法test_can_save_a_post_request中添加3行 ...
- npm安装node-sass报msbuild相关错误的解决办法
转自:https://blog.csdn.net/Amio_/article/details/87931733 https://www.cnblogs.com/diffx/p/10510868.htm ...
- Vue -- mounted方法中调用methods的方法(并取出mounted方法中回调函数的值)
结果:
- 阅读之https及加密原理
HTTPS(全称:Hypertext Transfer Protocol Secure,超文本传输安全协议),是以安全为目标的HTTP通道,简单讲是HTTP的安全版. 为什么需要https 使用htt ...
- WTL项目各种error的解决方法
error RC1015: cannot open include file 'atlres.h' 解决办法: 向“VC项目属性->资源->附加包含目录” 添加WTL的Include目录( ...
- uniapp开发微信小程序跳转出现navigateTo:fail page "pages/user/pages/user/address/address" is not found
在app.json文件中pages中: ,{ "path" : "pages/user/address/address", "style" ...
- yum安装nginx,配置资源访问出现403Forbidden问题
使用yum安装nginx后除了nginx自带页面其他配置页面都是403forbidden问题. 暂时的解决办法是,修该nginx配置文件中的user为root , 然后关闭seliunx或者添加ngi ...
- Python CGI编程Ⅸ
通过CGI程序传递下拉数据. HTML 下拉框代码如下: dropdown.py 脚本代码如下所示: 修改 dropdown.py 权限: CGI中使用Cookie 在 http 协议一个很大的缺点就 ...