公司nginx keepalived tomcat cxf 搭建高可用负载均衡实战系列1- keepalived安装配置

1,ip说明

vip

10.50.13.67

server1

10.50.13.68

server2

10.50.13.140

2,keepalived安装

keepalived通常与lvs或者nginx结合使用保证集群的高可用,keepalived的master会绑定一个vip用来对外服务并定期向backup发送消息,当backup接收不到消息时则会判定master已经挂掉,backup将升为master并且绑定vip继续对外提供服务,从而保证高可用。下面介绍keepalived的安装

安装依赖 openssl-devel popt-devel

yum install -y gcc openssl-devel popt-devel

下载 /keepalived-1.2.24.tar.gz

wget http://www.keepalived.org/software/keepalived-1.2.24.tar.gz

tar zxvf keepalived-1.2.24.tar.gz

cd keepalived-1.2.24

./configure --prefix=/opt/wacos/aaatool/keepalived

make && make install

设置开机启动

cp /opt/wacos/aaatool/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/

cp /opt/wacos/aaatool/keepalived/etc/sysconfig/keepalived /etc/sysconfig/

cp /ut/server/keepalived-1.2.24/sbin/keepalived /usr/sbin/

cp /opt/wacos/aaatool/keepalived/sbin/keepalived /usr/sbin/

chmod 755 /etc/init.d/keepalived

keepalived启动会默认读取keepalived/keepalived.conf配置文件

mkdir /etc/keepalived

拷贝keepalived.conf配置文件到/etc/keepalived/

keepalived.conf配置文件如下

! Configuration File for keepalived

global_defs {

router_id edu-proxy-02

}

vrrp_script chk_nginx {

script "/etc/keepalived/nginx_check.sh"

interval 2

weight -20

}

vrrp_instance VI_1 {

state BACKUP

interface eth0

virtual_router_id 51

mcast_src_ip 10.50.13.68

priority 90

advert_int 1

authentication {

auth_type PASS

auth_pass 1111

}

track_script {

chk_nginx

}

virtual_ipaddress {

10.50.13.67

}

}

启动 关闭 keepalived

service keepalived start[stop]

ip a查看是否绑定虚拟ip10.50.13.67

3,备keepalived安装

和说明主keepalived 过程一样,只是配置文件/etc/keepalived/keepalived。conf一处需要修改

mcast_src_ip 10.50.13.140

4,测试高可用

关掉10.50.13.67的keepalived后,发现vip绑定到了10.50.13.140

重启10.50.13.67的keepalived,vip又重新绑定到了10.50.13.67

时间: 2024-10-20 08:06:06

公司nginx keepalived tomcat cxf 搭建高可用负载均衡实战系列1- keepalived安装配置的相关文章

公司nginx keepalived tomcat cxf 搭建高可用负载均衡实战系列1- keepalived的安装配置

1,ip说明 vip 10.50.13.67 server1 10.50.13.68 server2 10.50.13.140 2,keepalived安装 keepalived通常与lvs或者nginx结合使用保证集群的高可用,keepalived的master会绑定一个vip用来对外服务并定期向backup发送消息,当backup接收不到消息时则会判定master已经挂掉,backup将升为master并且绑定vip继续对外提供服务,从而保证高可用.下面介绍keepalived的安装 安装依

使用Nginx1.9.9+Keepalived1.2.x搭建高可用负载均衡集群

一 简介以及原理介绍 (1)Nginx概念介绍: Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行.由俄罗斯的程序设计师Igor Sysoev所开发.其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度.京东.新浪.网易.腾讯.淘宝等 (2)Keepalived概念介绍: Keepalived的作用是检测服务器的状态,如果有一台we

Nginx+Keepalived搭建高可用负载均衡集群

Nginx+Keepalived搭建高可用负载均衡集群   一. 环境说明 前端双Nginx+keepalived,nginx反向代理到后端的tomcat集群实现负载均衡,Keepalived实现集群高可用. 操作系统: Centos 6.6_X64 Nginx版本: nginx-1.9.5 Keepalived版本:keepalived-1.2.13 结构: Keepalived+nginx-MASTER:10.6.1.210         Keepalived+nginx-BACKUP:

Nginx+Keepalived(双机热备)搭建高可用负载均衡环境(HA)

原文:https://my.oschina.net/xshuai/blog/917097 摘要: Nginx+Keepalived搭建高可用负载均衡环境(HA) http://blog.csdn.net/xyang81/article/details/52554398可以看更多介绍 Keepalived的介绍可以百度一堆一堆的资料.一定要看看哦. 1.基于上一篇博客总结,再次安装一个虚拟机当backup服务器,这个服务器只安装Keepalived+Nginx即可 2.Master还是上一篇博文的

LVS基础及LVS+Keepalived实现双主高可用负载均衡

LVS基础及LVS+Keepalived实现双主高可用负载均衡 LB集群: (Load  Balancing)即负载均衡集群,其目的是为了提高访问的并发量及提升服务器的性能,其    实现方式分为硬件方式和软件方式. 硬件实现方式: 常用的有 F5公司的BIG-IP系列.A10公司的AX系列.Citrix公司的 NetScaler系列等 软件实现方式: LVS工作于传输层.nginx工作于应用层.haproxy工作于传输层和应用层 本文主要讲解LVS. 一.什么是LVS ? 1. LVS:(Li

Keepalived+Haproxy双主高可用负载均衡web和mysql综合实验

日期及版本:2014.5.4v1.0 架构图 实验目的: 1.Haproxy+Keepalived双主双机高可用模型,keepalived为Haproxy主从提供高可用保证haproxy-master若挂掉haproxy-backup能无缝接管,haproxy为后端Web提供负载均衡,缓解并发压力,实现WEB站点负载均衡+高可用性: 2. Haproxy反代web做动静分离: 3. Haproxy反代mysql 算法leastconn和roundrobin的不同效果: 系统环境: OS:cent

使用Keepalived+ipvs构建(高可用+负载均衡)环境!

之前写过一个heartbeat-ldirectord实现LVS的高可用,这里引入一个轻量级的程序Keepalived基于VRRP协议工作,也能为服务提供高可用功能,这个程序的开发初衷是为了给lvs提供高可用. 下面我们来看看如何使用keepalived+ipvs实现高可用+负载均衡. 在RHEL6.4以后就提供了rpm格式的安装包,这里我们用源码编译安装. 先去官网下载源码包http://keepalived.org/ 解压源程序包,预编译配置,编译程序,安装程序. tar zxvf keepa

【Linux运维-集群技术进阶】Nginx+Keepalived+Tomcat搭建高可用/负载均衡/动静分离的Webserver集群

额.博客名字有点长.. . 前言 最终到这篇文章了,心情是有点激动的. 由于这篇文章会集中曾经博客讲到的全部Nginx功能点.包含主要的负载均衡,还有动静分离技术再加上这篇文章的重点.通过Keepalived实现的HA(High Available).为什么要实现高可用呢?曾经在搭建的时候仅仅用了一台Nginxserver,这种话假设Nginxserver宕机了,那么整个站点就会挂掉.所以要实现Nginx的高可用,一台挂掉还会有还有一台顶上去.从而保证站点能够持续的提供服务. 关于负载均衡和动静

LVS+Keepalived搭建高可用负载均衡

应用环境: LVS负责多台WEB端的负载均衡(LB):Keepalived负责LVS的高可用(HA),这里介绍主备模型. 测试环境: HOSTNAME IP SYSTEM DR1 192.168.10.234 CENTOS7.5 DR2 192.168.10.235 CENTOS7.5 RS1 192.168.10.236 CENTOS7.5 RS2 192.168.10.237 CENTOS7.5 VIP 192.168.10.239 DR配置步骤: 安装软件(在DR1和DR2上分别安装) y