[HA]负载均衡:HAPROXY与KEEPALIVED强强联合
第一步:更改系统控制配置文件,同意分配虚拟IP(VIP)
/etc/sysctl.conf net.ipv4.ip_nonlocal_bind=1
<pre style="word-wrap: normal; line-height: 18px;">sysctl -p
步骤二:安装HAPROXY和KEEPALIVED
apt-get update && apt-get install keepalived haproxy -y
步骤三:配置KEEPALIVED
etc/keepalived/keepalived.conf
global_defs {
router_id haproxy1
}
vrrp_script haproxy {
script "killall -0 haproxy"
interval 2
weight 2
}
vrrp_instance 50 {
virtual_router_id 50
advert_int 1
priority 101
state MASTER
interface eth0
virtual_ipaddress {
192.168.1.32 dev eth0
}
track_script {
haproxy
}
}
步骤四:配置HAPROXY
/etc/haproxy/haproxy.cfg global
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
log 192.168.1.30 local0
stats socket /var/lib/haproxy/stats
maxconn 4000 defaults
log global
mode http
option httplog
option dontlognull
contimeout 5000
clitimeout 50000
srvtimeout 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http listen stats 192.168.1.30:80
mode http
stats enable
stats uri /stats
stats realm HAProxy\ Statistics
stats auth admin:password
步骤五:启动HAPROXY和KEEPALIVED服务
service keepalived restart
service haproxy restart
步骤六:检測虚拟IP
# ip -a | grep eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 192.168.1.30/24 brd 192.168.1.255 scope global eth0
inet 192.168.1.32/32 scope global eth0
版权声明:本文博客原创文章,博客,未经同意,不得转载。
[HA]负载均衡:HAPROXY与KEEPALIVED强强联合的更多相关文章
- Dubbo入门到精通学习笔记(二十):MyCat在MySQL主从复制的基础上实现读写分离、MyCat 集群部署(HAProxy + MyCat)、MyCat 高可用负载均衡集群Keepalived
文章目录 MyCat在MySQL主从复制的基础上实现读写分离 一.环境 二.依赖课程 三.MyCat 介绍 ( MyCat 官网:http://mycat.org.cn/ ) 四.MyCat 的安装 ...
- Centos7.2下基于Nginx+Keepalived搭建高可用负载均衡(一.基于Keepalived搭建HA体系)
说明 本文只为方便日后查阅,不对一些概念再做赘述,网上都有很多明确的解释,也请大家先了解相关概念. 两台搭建HA的服务器是华为云上的ECS(不要忘记开通VPC,保证我们的服务器都处在一个内网环境),由 ...
- 高可用负载均衡 haproxy+keepalived
服务器 20.0.0.206 10.0.0.206 bs-hk-hk01 高可用负载均衡节点 2c2g 20.0.0.207 10.0.0.207 bs-hk-hk02 高可用负载均衡节点 ...
- 6、负载均衡HAproxy介绍
6.1.常用负载均衡器软件说明: 现在常用的三大开源软件负载均衡器分别是Nginx.HAProxy.LVS. 1.nginx负载均衡的特点: (1)工作在网络的七层之上,可以针对http应用做一些分流 ...
- 七层负载均衡——HAProxy
HAProxy入门 HAProxy是一款提供高可用性.负载均衡以及基于TCP(第四层)和HTTP(第七层)应用的代理软件,HAProxy是完全免费的.借助HAProxy可以快速并且可靠的提供基于TCP ...
- 主从热备+负载均衡(LVS + keepalived)
前言 淘宝架构师李智慧大牛的书籍<大型网站技术架构>以及旭龙兄的博客 --->[大型网站技术实践]初级篇:借助LVS+Keepalived实现负载均衡. 从上参考而得来本文,本文旨 ...
- 负载均衡-haproxy安装配置
HAProxy提供高可用性.负载均衡以及基于TCP和HTTP应用的代理,支持虚拟主机,它是免费.快速并且可靠的一种解决方案.HAProxy特别适用于那些负载特大的web站点,这些站点通常又需要会话保持 ...
- Always on (HA 负载均衡 异地容灾 一体化 )
Sqlserver 2012 开始,以往困扰我们的三个棘手问题:可扩展性.数据保护.异地容灾可以统一通过alwayson 来实现.2014 支持secondary 节点更是达到8个.在硬件调配方面比 ...
- 解决nginx负载均衡高可用keepalived只针对物理机的问题
在高可用keepalived软件,在默认的情况下仅仅在对方机器宕机或keepalived停掉的时候才会接管业务. 但是在实际工作过程中,例如在nginx负载均衡工作实例中,nginx服务已停止,而ke ...
随机推荐
- C++——STL中三种顺序容器的简要差别
C++ STL 提供了3个顺序容器 :vector, deque, list Vector动态数组.支持高速訪问:list双向链表,支持高速插入和删除. vector 中的元素是顺序存放的.所以随机訪 ...
- 【cocos2d-x制作别踩白块儿】第一期:游戏介绍
这一系类文章.我们将来分析时下最火的一款游戏 -- 别踩白块儿. 无图无真相,先上图 这就是我们终于要完毕项目的效果图. 游戏刚開始的最以下有一栏为黄色,紧接着上面每一行都是有一个黑色块,其余为白色块 ...
- css 实现table 隔行变色
<html> <head> <title>Member List</title> <style> <!-- .datalist{ bo ...
- 手把手教popupWindow从下往上,以达到流行效果
效果如图所看到的,点击開始button,popWindow从下往上出来,再点击popWindow外面,popWindow又从上往下消失 能够看出来,上面的popupWindow是半透明的,后面我会细说 ...
- atitit.报告最佳实践oae 和报告引擎的选择
atitit.报告最佳实践oae 与报表引擎选型 1. 报表的基本的功能and结构 2 1.1. 查询设计器(配置化,metadata in html) ,anno 2 1.2. 查询引擎 2 1.3 ...
- 正确Linux新手很实用20命令
//正确Linux新手很实用20命令 //slwang 2014.4.19 1, ls list directory contents 内容 ls -l //以详情模式(long li ...
- MyBatis+Spring+Spring MVC整合开发
MyBatis+Spring+Spring MVC整合开发课程观看地址:http://www.xuetuwuyou.com/course/65课程出自学途无忧网:http://www.xuetuwuy ...
- POJ训练计划2418_Hardwood Species(Trie树)
解题报告 Tire树. #include <iostream> #include <cstring> #include <cstdio> #include < ...
- String,StringBuffer和StringBuilder的异同
String,StringBuffer和StringBuilder的异同 ...
- POJ 2914 Minimum Cut 最小割图论
Description Given an undirected graph, in which two vertices can be connected by multiple edges, wha ...