标签归档:HA

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

继续阅读

Install HAProxy and Keepalived (Virtual IP)

To avoid a single point of failure with your HAProxy, one would set up two identical HAProxy instances (one active and one standby) and use Keepalived to run VRRP between them. VRRP provides a virtual IP address to the active HAProxy, and transfers the Virtual IP to the standby HAProxy in case of failure. This is seamless because the two HAProxy instances need no shared state.

In this example, we are using 2 nodes to act as the load balancer with IP failover in front of our database cluster. VIP will be floating around between LB1 (master) and LB2 (backup). When LB1 is down, the VIP will be taking over by LB2 and once the LB1 up again, the VIP will be failback to LB1 since it hold the higher priority number.  继续阅读

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

Make a Web Application Highly Available with IP Failover, Heartbeat, Pacemaker, and DRBD on Fedora 13

High availability refers to the practice of keeping online resources available through node failure or system maintenance. This guide will demonstrate a method for using two Linodes to keep a website online, even when the node initially hosting it is powered off. IP failover, HeartbeatExternal Link 3.0,PacemakerExternal Link 1.1, DRBDExternal Link (Distributed Replicated Block Device), MySQLExternal Link and ApacheExternal Link 2.2 will be used for this example configuration.

As high availability is a complex topic with many methods available for achieving various goals, it should be noted that the method discussed here may not be appropriate for some use cases. However, it should provide a good foundation for developing a customized HA solution. 继续阅读

DRBD+heartbeat+mysql搭建高可用数据库

DRBD是一种块设备的实现,与heartbeat的搭配,被广泛用于linux下的高可用(HA)方案中,本文是介绍如何在已经含有数据的分区或硬盘上搭建drbdheartbeat高可用的mysql服务。

在对含有数据的分区或硬盘建立drbd高可用的时候,请确认以下三件事。

1,所在分区或硬盘可以扩容,比如使用lvm
2,所在分区或硬盘上的文件系统支持shrinking
3,如果以上两条都不能满足,请使用外部metadata

这里使用的是第一种方法,具体请接着往下看 继续阅读

在已有数据的的硬盘上创建drbd高可用复制

内容:如何在不影响原有数据的情况下配置drbd

试验目的:在已有数据的硬盘上创建drbd复制
试验环境:vmware模拟环境
192.168.211.128(linux01) CentOS release 5.3 (Final)
192.168.211.129(linux02) CentOS release 5.3 (Final)
drbd-8.3.4版本源码编译安装 继续阅读

DRBD:Linux平台下实现高可用方案

DRBD实际上是一种块设备的实现,主要被用于Linux平台下的高可用(HA)方案之中。他是有内核模块和相关程序而组成,通过网络通信来同步镜像整个设备,有点类似于一个网络RAID的功能。也就是说当你将数据写入本地的DRBD设备上的文件系统时,数据会同时被发送到网络中的另外一台主机之上,并以完全相同的形式记录在一个文件系统中(实际上文件系统的创建也是由DRBD的同步来实现的)。本地节点(主机)与远程节点(主机)的数据可以保证实时的同步,并保证IO的一致性。所以当本地节点的主机出现故障时,远程节点的主机上还会保留有一份完全相同的数据,可以继续使用,以达到高可用的目的。

在高可用(HA)解决方案中使用DRBD的功能,可以代替使用一个共享盘阵存储设备。因为数据同时存在于本地主机和远程主机上,在遇到需要切换的时候,远程主机只需要使用它上面的那份备份数据,就可以继续提供服务了。 继续阅读

使用简单的 5 个步骤设置 Web 服务器集群

使用 Linux Virtual Server 和 Linux-HA.org 的 Heartbeat 进行构建和运行

来源:http://www.ibm.com/developerworks/cn/linux/l-linux-ha/index.html

使用 Linux Virtual Server 和 Heartbeat v2,分 5 个步骤跨越多个物理或虚拟 Linux® 服务器轻松构建高度可用的 Apache Web 服务器集群。

通过在多个处理器之间分担工作负载并采用多种软件恢复技术,能够提供高度可用的环境并提高环境的总体 RAS(可靠性、可用性和可服务性)。可以得到的好处包括:更快地从意外中断中恢复运行,以及将意外中断对终端用户的影响降至最低。

为了更好地理解这篇文章,您需要熟悉 Linux 和连网的基本知识,还需要配置好 Apache 服务器。本文的示例基于标准的 SUSE Linux Enterprise Server 10 (SLES10) 安装,但是使用其他版本的明智用户也应该可以采用文中展示的方法。

本文展示了健壮的 Apache Web 服务器堆栈,它拥有 6 个 Apache 服务器节点(虽然 3 个节点就足以支持文中阐述的步骤),以及 3 个 Linux Virtual Server (LVS) 控制器。我们使用 6 个 Apache 服务器节点,可以在测试时实现更高的工作负载吞吐量,从而模拟更大型的部署。文中展示的架构应该可以支持更多的控制器和后端 Apache 服务器(在资源允许的情况下),但是我们并未进行更深入的尝试。图 1 展示了使用 Linux Virtual Server 和 linux-ha.org 组件的实现。 继续阅读