HAproxy

HAProxy - URL Based routing with load balancing

有些话、适合烂在心里 提交于 2019-11-27 17:42:48
I am new to HAProxy and I have a question about HAProxy configuration which helps me make a key decision in taking the right approach. This will greatly help me deciding the architecture. I have 3 apps. Let's say app1 , app2 , app3 . Each app is differentiated by the urls as follows: www.example.com/app1/123 -> app1 www.example.com/app2/123 -> app2 www.example.com/app3/123 -> app3 I am planning to have 2 instances of each app in 2 different regions: Region 1 - app1, app2, app3 Region 2 - app1, app2, app3 I see 2 methods to configure this but I am not sure which is the best practice here:

编译安装haproxy2.0

 ̄綄美尐妖づ 提交于 2019-11-27 12:21:36
先解决lua环境,(因为centos自带的版本不符合haproxy要求的最低版本(5.3)先安装Lua依赖的包 [root@slave-master lua-5.3.5]# yum install vim iotop bc gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel zip unzip zlib-devel net-tools lrzsz tree ntpdate telnet lsof tcpdump wget libevent libevent-devel bc systemd-devel bash-completion traceroute -y[root@slave-master lua-5.3.5]# yum install libtermcap-devel ncurses-devel libevent-devel readline-devel -y 下载lua并编译安装 [root@slave-master haproxy-2.0.4]# cd /usr/local/src/[root@slave-master src]# tar xf lua-5.3.5.tar.gz [root@slave-master src]# cd lua-5.3.5[root@slave-master

SaltStack自动化运维工具

痞子三分冷 提交于 2019-11-27 10:53:02
一.什么是salt Salt 是: 一个配置管理系统,能够维护预定义状态的远程节点(比如,确保指定的报被安装,指定的服务在运行) 一个分布式远程执行系统,用来在远程节点(可以是单个节点,也可以是任意规则挑选出来的节点)上执行命令和查询数据 二.Salt的核心功能 1.使命令发送到远程系统是并行的而不是串行的 2.使用安全加密的协议 3.使用最小最快的网络载荷 4.提供简单的编程接口 Salt同样引入了更加细致化的领域控制系统来远程执行,使得系统成为目标不止可以通过主机名,还可以通过系统属性。 三.salt使用Python客户端接口 为了允许简单的扩展,Salt执行程序可以写为纯Python模块。数据从Salt执行过程中收集到可以发送回master服务端,或者发送到任何任意程序。Salt可以从一个简单的Python API调用,或者从命令行被调用,所以Salt可以用来执行一次性命令,也可以作为一个更大的应用程序的一个组成部分。 二.安装salt 1.配置yum源 mv salt /var/www/html/ [rhel-source] name= Red Hat Enterprise Linux $releasever - $basearch - Source baseurl= http:// 172.25 . 1.250 /source6. 5 enabled= 1

Enable http2 with Tomcat in Spring Boot

拟墨画扇 提交于 2019-11-27 09:41:50
问题 Tomcat 8.5 , which will be the default in Spring Boot 1.4 , (to be released tomorrow) supports http2 . How can http2 be enabled in a Spring Boot application? 回答1: You need to add the HTTP 2 upgrade protocol to Tomcat's connector. You can do that by customizing the embedded Tomcat container: Java 8: @Bean public EmbeddedServletContainerCustomizer tomcatCustomizer() { return (container) -> { if (container instanceof TomcatEmbeddedServletContainerFactory) { (

Duplicate TCP traffic with a proxy

守給你的承諾、 提交于 2019-11-27 05:28:32
问题 I need to send (duplicate) traffic from one machine (port) and to two different machines (ports). I need to take care of TCP session as well. In the beginnig I used em-proxy, but it seems to me that the overhead is quite large (it goes over 50% of cpu). Then I installed haproxy and I managed to redirect traffic (not to duplicate). The overhead is reasonable (less than 5%). The problem is that I could not say in haproxy config file the following: - listen on specific address:port and whatever

http keep-alive in the modern age

你离开我真会死。 提交于 2019-11-27 04:56:36
问题 So according to the haproxy author, who knows a thing or two about http: Keep-alive was invented to reduce CPU usage on servers when CPUs were 100 times slower. But what is not said is that persistent connections consume a lot of memory while not being usable by anybody except the client who openned them. Today in 2009, CPUs are very cheap and memory is still limited to a few gigabytes by the architecture or the price. If a site needs keep-alive, there is a real problem. Highly loaded sites

Handling OPTIONS request in nginx

拜拜、爱过 提交于 2019-11-27 01:31:49
问题 We're using HAProxy as a load balancer at the moment, and it regularly makes requests to the downstream boxes to make sure they're alive using an OPTIONS request: OPTIONS /index.html HTTP/1.0 I'm working with getting nginx set up as a reverse proxy with caching (using ncache). For some reason, nginx is returning a 405 when an OPTIONS request comes in: 192.168.1.10 - - [22/Oct/2008:16:36:21 -0700] "OPTIONS /index.html HTTP/1.0" 405 325 "-" "-" 192.168.1.10 When hitting the downstream webserver

haproxy的代理中继用法

醉酒当歌 提交于 2019-11-26 23:57:59
背景: 现有: 一台baidu/ali/tecent云服务器A(地址为a.a.a.a); 一台VPS B(地址为b.b.b.b), B中搭建有ss,监听端口为8000. 需求: 一:使用A做跳板机访问B中搭建的ss。且使用A的12344端口。(即把A的12344转发到B的8000) 二:使用A做跳板机访问国内网站。且使用A的12345端口。 其他要求:使用haproxy实现。 解决方案: 对需求一,只需要安装haproxy,对需求二,额外安装polipo(或其他http代理服务器)完成。 配置/etc/haproxy/haproxy.cfg如下: global user haproxy group haproxy daemon defaults log global mode tcp option dontlognull timeout connect 5000 timeout client 50000 timeout server 50000 #需求一: frontend ss-in bind *:12344 default_backend ss-out backend ss-out server server1 a.a.a.a:17001 maxconn 20480 # 需求二: frontend sunflower-in bind *:12345 default

Load Balancing (HAProxy or other) - Sticky Sessions

感情迁移 提交于 2019-11-26 22:46:18
问题 I'm working on scaling out my app to multiple servers, and one requirement is that a client is always communicating with the same server (too much live data is used to allow bouncing between servers efficiently). My current setup is a small server cluster (using Linode). I have a frontend node running HAProxy using "balance source" so that an IP is always pointed towards the same node. I'm noticing that "balance source" is not a very even distribution. With my current test setup (2 backend

Linux 运维经典面试题(四)

拈花ヽ惹草 提交于 2019-11-26 20:38:43
Linux 运维经典面试题 1、什么是运维?什么是游戏运维? 1)运维是指大型组织已经建立好的网络软硬件的维护,就是要保证业务的上线与运作的正常, 在他运转的过程中,对他进行维护,他集合了网络、系统、数据库、开发、安全、监控于一身的技术 运维又包括很多种,有DBA运维、网站运维、虚拟化运维、监控运维、游戏运维等等 2)游戏运维又有分工,分为开发运维、应用运维(业务运维)和系统运维 开发运维:是给应用运维开发运维工具和运维平台的 应用运维:是给业务上线、维护和做故障排除的,用开发运维开发出来的工具给业务上线、维护、做故障排查 系统运维:是给应用运维提供业务上的基础设施,比如:系统、网络、监控、硬件等等 总结:开发运维和系统运维给应用运维提供了“工具”和“基础设施”上的支撑 开发运维、应用运维和系统运维他们的工作是环环相扣的 2、在工作中,运维人员经常需要跟运营人员打交道,请问运营人员是做什么工作的? 游戏运营要做的一个事情除了协调工作以外 还需要与各平台沟通,做好开服的时间、开服数、用户导量、活动等计划 3、现在给你三百台服务器,你怎么对他们进行管理? 管理3百台服务器的方式: 1)设定跳板机,使用统一账号登录,便于安全与登录的考量。 2)使用salt、ansiable、puppet进行系统的统一调度与配置的统一管理。 3)建立简单的服务器的系统、配置、应用的cmdb信息管理