标签归档:Load Balance

Load balancing and HA for multiple applications with Apache, HAProxy and keepalived

Let’s imagine a situation where, for whatever reason, we have a number of web applications available for users, and we want users to access them using, for example,

https://example.com/appname/

Each application is served by a number of backend servers, so we want some sort of load balancing. Each backend server is not aware of the clustering, and expects requests relative to /, not /appname. Also, SSL connections and caching are needed. The following picture illustrates the situation:

Here is an example of how to implement such a setup using Apache, HAProxy and keepalived. The provided configuration samples refer to the load balancer machine(s). Here’s the logical structure of a load balancer described here:

Apache

继续阅读

High availability load balancing using HAProxy on Ubuntu

In this post we will show you how to easily setup loadbalancing for your web application. Imagine you currently have your application on one webserver called web01:

1
2
3
4
5
6
7
+---------+
| uplink  |
+---------+
     |
+---------+
|  web01  |
+---------+

But traffic has grown and you’d like to increase your site’s capacity by adding more webservers (web02 and web03), aswell as eliminate the single point of failure in your current setup (if web01 has an outage the site will be offline).

1
2
3
4
5
6
7
8
9
              +---------+
              | uplink  |
              +---------+
                   |
     +-------------+-------------+
     |             |             |
+---------+   +---------+   +---------+
|  web01  |   |  web02  |   |  web03  |
+---------+   +---------+   +---------+

In order to spread traffic evenly over your three web servers, we could install an extra server to proxy all the traffic an balance it over the webservers. In this post we will use HAProxy, an open source TCP/HTTP load balancer. (see: http://haproxy.1wt.eu/) to do that:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
              +---------+
              |  uplink |
              +---------+
                   |
                   +
                   |
              +---------+
              | loadb01 |
              +---------+
                   |
     +-------------+-------------+
     |             |             |
+---------+   +---------+   +---------+
|  web01  |   |  web02  |   |  web03  |
+---------+   +---------+   +---------+

So our setup now is:
– Three webservers, web01 (192.168.0.1), web02 (192.168.0.2 ), and web03 (192.168.0.3) each serving the application
– A new server (loadb01, ip: (192.168.0.100 )) with Ubuntu installed. 继续阅读

Setup Linux loadbalancer with LVS, ldirectord and heartbeat

As my last post, I had built a more healthy load balancer. But it is still not practical. Because if the linux director fails, the system will not work. The high availability should be considered. In this post, I list my steps to implement HA function.

I added another machine to the system. The environment of my lab is as below.

ha1: eth0: 192.168.26.201 eth1: 192.168.26.221(heartbeat)
ha2: eth0: 192.168.26.202 eth1: 192.168.26.222(heartbeat)
rs1: eth0: 192.168.26.211
rs2: eth0: 192.168.26.212
VIP: 192.168.26.200
gateway: 192.168.26.1  继续阅读

Linux 负载均衡

在调度器的实现技术中,IP负载均衡技术是效率最高的。在已有的IP负载均衡技术中有通过网络地址转换(Network Address Translation)将一组服务器构成一个高性能的、高可用的虚拟服务器,我们称之为VS/NAT技术(Virtual Server via Network Address Translation),大多数商品化的IP负载均衡调度器产品都是使用此方法,如Cisco的LocalDirector、F5的Big/IP和Alteon的ACEDirector。在分析VS/NAT的缺点和网络服务的非对称性的基础上,我们提出通过IP隧道实现虚拟服务器的方法VS/TUN(Virtual Server via IP Tunneling),和通过直接路由实现虚拟服务器的方法VS/DR(Virtual Server via Direct Routing),它们可以极大地提高系统的伸缩性。所以,IPVS软件实现了这三种IP负载均衡技术,它们的大致原理如下: 继续阅读

利用keepalived 实现HA&LB

利用keepalived 实现HA&LB
装包
下载地址 wget http://www.keepalived.org/software/keepalived-1.1.17.tar.gz
./configure –prefix=/ –mandir=/usr/local/share/man
–with-kernel-dir=/usr/src/kernels/2.6.18-128.el5-i686/

以上这步是 设定安装路径以及帮助文件的路径 可以自行定义 后面那段具体作用大概是
with-kernel-dir 这个参数很重要,这个参数并不表示我们要把keepalived编进内核,
而是指使用内核源码里面的头文件,也就是include目录 (如果需要用到LVS才需要这么做,
否则是不需要的,而且如果要使用netlink,还需要link_watch.cz这个文件)
make
make install 继续阅读

Setting Up A High-Availability Load Balancer (With Failover and Session Support) With HAProxy/Heartbeat On Debian Lenny

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 05/15/2009

This article explains how to set up a two-node load balancer in an active/passive configuration with HAProxy and heartbeat on Debian Lenny. The load balancer sits between the user and two (or more) backend Apache web servers that hold the same content. Not only does the load balancer distribute the requests to the two backend Apache servers, it also checks the health of the backend servers. If one of them is down, all requests will automatically be redirected to the remaining backend server. In addition to that, the two load balancer nodes monitor each other using heartbeat, and if the master fails, the slave becomes the master, which means the users will not notice any disruption of the service. HAProxy is session-aware, which means you can use it with any web application that makes use of sessions (such as forums, shopping carts, etc.). 继续阅读

HAProxy实现负载均衡

一, HAProxy 介绍    反向代理服务器,支持双机热备支持虚拟主机,但其配置简单,拥有非常不错的服务器健康检查功能,当其代理的后端服务器出现故障, HAProxy会自动将该服务器摘除,故障恢复后再自动将该服务器加入。新的1.3引入了frontend,backend,frontend根据任意HTTP请求头内容做规则匹配,然后把请求定向到相关的backend. 继续阅读

LVS搭建高可用性Web负载均衡服务器

LVS搭建高可用性Web负载均衡服务器(两台LVS服务器单网卡,兼作realserver) 实际应用了大半年了,使用mcast做多播检测,由于vlan太大偶尔出了点问题,(改ucast或改mcast eth1 …)解决问题。

一. 系统需求
实现Linux下的Web服务器负载均衡,LVS以主备方式工作,并且实现LVS机器同时加入Web服务器群。 继续阅读

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 继续阅读

“软”负载均衡学习点滴

目录

需求转而学习… 2

“软”负载均衡… 2

LVS (Linux Virtual Server)… 3

Virtual Server三种模式介绍… 3

Virtual Server三种模式的比较… 5

Virtual Server三种模式实践… 6

三种模式下的简单压力测试… 9

HA-Proxy. 10

HA-Proxy安装和使用… 10

HA-Proxy的压力测试结果… 15

“软”负载学习心得… 15 继续阅读