Installing haproxy load balancing for http and https--转载
This example will guide you through a simple IP based load balancing solution that handles ssl traffic.
The Configuration =
- Load Balancer: <192.168.0.2> // will be our haproxy server
- Web Server 1: <192.168.0.10> // web application server 1
- Web Server 2: <192.168.0.20> // web application server 2
- Admin Panel Port 8080: <192.168.0.2> // Statistics Panel on port 8080
Web Server 1
Load Balancer <
Web Server 2
Step 1: Get and Install haproxy
We’ll be using the 1.3.17 src files to install haproxy. You can get them from http://haproxy.1wt.eu/
- wget http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.17.tar.gz
- cd haproxy-1.3.17
- make TARGET=linux26
- cp /path/to/haproxy-1.3.17/examples/haproxy.init /etc/init.d/haproxy
- chmod +x /etc/init.d/haproxy
We’re going to add a haproxy user and run it in a chroot jail. Be sure to read up on other security measures for your server.
- useradd haproxy
- mkdir /var/chroot/haproxy
- chown haproxy:haproxy /var/chroot/haproxy
- chmod 700 /var/chroot/haproxy
This will be a simple load balancing. The HAProxy server will listen to 1 IP and distribute to 2 servers.
- global
- maxconn 10000 # Total Max Connections.
- log 127.0.0.1 local0
- log 127.0.0.1 local1 notice
- daemon
- nbproc 1 # Number of processes
- user haproxy
- group haproxy
- chroot /var/chroot/haproxy
- defaults
- log global
- option httplog
- mode tcp
- clitimeout 60000
- srvtimeout 30000
- contimeout 4000
- retries 3
- redispatch
- option httpclose
- listen load_balanced 192.168.0.2:80,192.168.0.2:443
- balance source
- option ssl-hello-chk
- option forwardfor
- server webserver1 192.168.0.10 weight 1 maxconn 5000 check
- server webserver2 192.168.0.20 weight 1 maxconn 5000 check
- listen admin_stats 192.168.0.2:8080
- mode http
- stats uri /my_stats
- stats realm Global\ statistics
- stats auth username:password
Step 4: Configuring logging
Edit /etc/sysconfig/syslog
- SYSLOGD_OPTIONS=”-m 0 -r”
Installing haproxy load balancing for http and https--转载的更多相关文章
- gRPC Load Balancing
gRPC Load Balancing 翻译自:https://grpc.io/blog/grpc-load-balancing/ 这是gRPC负载均衡的第一篇,后续会给出基于golang XDS服务 ...
- 【架构】How To Use HAProxy to Set Up MySQL Load Balancing
How To Use HAProxy to Set Up MySQL Load Balancing Dec 2, 2013 MySQL, Scaling, Server Optimization U ...
- Load Balancing OpenSSH SFTP with HAProxy
In my previous post I described how we setup a Ubuntu Server (12.0.4) as an OpenSSH SFTP server. In ...
- 负载均衡(Load Balancing)学习笔记(二)
概述 文章负载均衡(Load Balancing)学习笔记(一) 讲述了负载均衡的一般性原理,本文继续介绍常见的实现负载均衡的方法. HTTP重定向 HTTP重定向服务器是一台普通的Web服务器,用户 ...
- 负载均衡(Load Balancing)学习笔记(一)
概述 在分布式系统中,负载均衡(Load Balancing)是一种将任务分派到多个服务端进程的方法.例如,将一个HTTP请求派发到实际的Web服务器中执行的过程就涉及负载均衡的实现.一个HTTP请求 ...
- Elastic Load Balancing with Sticky Sessions
Elastic Load Balancing with Sticky Sessions — Shlomo Swidler https://shlomoswidler.com/2010/04/elast ...
- Network Load Balancing Technical Overview--reference
http://technet.microsoft.com/en-us/library/bb742455.aspx Abstract Network Load Balancing, a clusteri ...
- NGINX Load Balancing - HTTP Load Balancer
This chapter describes how to use NGINX and NGINX Plus as a load balancer. Overview Load balancing a ...
- NGINX Docs | Load Balancing Apache Tomcat Servers with NGINX Open Source and NGINX Plus
NGINX Docs | Load Balancing Apache Tomcat Servers with NGINX Open Source and NGINX Plushttps://docs. ...
随机推荐
- 【Win10】实现 ListViewBase 平滑滚动
首先解释下标题的 ListViewBase 是什么鬼.ListViewBase 我们可以查阅 MSDN 文档:https://msdn.microsoft.com/zh-cn/library/wind ...
- Elasticsearch 健康状态处理
笔者在自己的 ubuntu 服务器上使用 GET /_cat/health?v 命令时,返回值如下所示 可以看到集群状态为 yellow,这是什么意思呢?原来在 es 的集群状态中,有三种情况,官网描 ...
- saprk2 structed streaming
netcat (windows) >nc -L -p 9999 import java.sql.Timestamp import org.apache.spark.sql.SparkSessio ...
- DBCC--常用命令
------------------------------------------------------ --1 DBCC FLUSHPROCINDB 清除SQL SERVER服务器内存中某个数据 ...
- Java计算手机九宫格锁屏图案连接9个点的方案总数
(一)问题 九宫格图案解锁连接9个点共有多少种方案? (二)初步思考 可以把问题抽象为求满足一定条件的1-9的排列数(类似于“八皇后问题”),例如123456789和987654321都是合法的(按照 ...
- ASP.Net Core 2.2 MVC入门到基本使用系列 (三)
本教程会对基本的.Net Core 进行一个大概的且不会太深入的讲解, 在您看完本系列之后, 能基本甚至熟练的使用.Net Core进行Web开发, 感受到.Net Core的魅力. 本教程知识点大体 ...
- 截图-----Selenium快速入门(十二)
在自动化测试过程中,截图是常见的操作,因为有时候单靠程序无法判断是否已得到期望的结果,所以需要截图判断.又或者截图是作为判断的存证.Selenium的截图操作也是非常简单,而且自带了一个文件操作类Fi ...
- Angular6 学习笔记——组件详解之组件通讯
angular6.x系列的学习笔记记录,仍在不断完善中,学习地址: https://www.angular.cn/guide/template-syntax http://www.ngfans.net ...
- sql 中如何查询某一列的数据在另一个表中有没有?
假设表table1,列a,表table2,列bselect a from table1where a not in(select b from table2)
- 程序媛计划——python数据库
#实例:用数据库存储日记,实现日记本功能 #流程 #创建数据库 #coding:utf-8 import sqlite3 connect=sqlite3.connect('test.db') conn ...