`
steven-zhou
  • 浏览: 212415 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

Linux keepalived配置

阅读更多
1.1 安装ipvsadm-1.24-8.1.x86_64.rpm
rpm -ivh ipvsadm-1.24-8.1.x86_64.rpm


1.2.检查ipvsadm是否被正确安装:
[root@proxy1 ~]# ipvsadm
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn


1.3.查看是否存在ip_vs模块:
[root@proxy1 ~]# lsmod | grep ip_vs
ip_vs                 121217  0 


2.1 安装keepalived
下载地址:http://www.keepalived.org/download.htm
tar -zxvf keepalived-1.1.18.tar.gz
cd keepalived-1.1.18
./configure --prefix=/usr --sysconf=/etc --with-kernel-dir=/usr/src/kernels/2.6.18-128.el5-x86_64/


2.2 configure成功后的显示为:
Keepalived configuration
Keepalived version : 1.1.15
Compiler : gcc
Compiler flags : -g -O2
Extra Lib : -lpopt -lssl -lcrypto
Use IPVS Framework : Yes
IPVS sync daemon support : Yes
Use VRRP Framework : Yes
Use LinkWatch : No
Use Debug flags : No


2.3 编译,安装
make
make install


3.1 编辑keepalved.conf配置文件(主服务器)
vi /etc/keepalived/keepalived.conf

global_defs {
        router_id NGBOSSLVS_NODE_1
}

vrrp_instance V_NGBOSS {
        state MASTER
        interface eth0
        lvs_sync_daemon_inteface eth0
        virtual_router_id 51
        priority 200
        advert_int 2
        authentication {
                auth_type PASS
                auth_pass 1111
        }
        virtual_ipaddress {
                10.238.15.103
        }
}


3.2 编辑keepalved.conf配置文件(备份服务器)
vi /etc/keepalived/keepalived.conf

global_defs {
        router_id NGBOSSLVS_NODE_2
}

vrrp_instance V_NGBOSS {
        state BACKUP
        interface eth0
        lvs_sync_daemon_inteface eth0
        virtual_router_id 51
        priority 100
        advert_int 2
        authentication {
                auth_type PASS
                auth_pass 1111
        }
        virtual_ipaddress {
                10.238.15.103
        }
}


4.1 将keepalived服务加入开机启动启动。
chkconfig --add keepalived
chkconfig --level 35 keepalived on


4.2 启动keepalived
keepalived


查看keepalived是否已经启动
[root@proxy1 keepalived]# ps -ef | grep keepalived
root      4003     1  0 Apr01 ?        00:00:00 keepalived -D
root      4004  4003  0 Apr01 ?        00:05:32 keepalived -D
root      4019  4003  0 Apr01 ?        00:05:39 keepalived -D


发现VIP 10.238.15.103地址,证明MASTER一起启动浮动IP
[root@proxy1 keepalived]# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:23:7d:d1:be:0e brd ff:ff:ff:ff:ff:ff
    inet 10.238.15.101/24 brd 10.238.15.255 scope global eth0
    inet 10.238.15.103/32 scope global eth0
    inet6 fe80::223:7dff:fed1:be0e/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 00:23:7d:d1:be:10 brd ff:ff:ff:ff:ff:ff
4: sit0: <NOARP> mtu 1480 qdisc noop 
    link/sit 0.0.0.0 brd 0.0.0.0
5: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop 
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
分享到:
评论

相关推荐

    中职网络搭建中出现的高可用性keepalived配置方法

    中职网络搭建中出现的高可用性keepalived配置方法,linux keepalived配置方法

    Redhat Linux 6 操作系统LVS+keepalived配置

    Redhat Linux 6 操作系统LVS_DR+Keepalived模式下配置的详细文档,按照文档的部署和配置可实现 LVS_DR+Keepalived的负载均衡。

    linux中安装nginx和keepalived

    ### Linux中安装Nginx与Keepalived的详细步骤及配置 #### 一、环境准备与依赖安装 在Linux环境中安装Nginx和Keepalived之前,首先要确保系统已安装了必要的开发工具和库文件。这包括GCC编译器、PCRE-devel用于正则...

    keepalived-1.2.18 Linux版本亲测可用 .zip

    为了提高安全性,可以设置防火墙规则限制VRRP协议的通信,同时监控CPU和内存使用情况,优化keepalived配置,减少资源占用。 总之,keepalived 1.2.18版本在Linux环境中的应用,为构建高可用、负载均衡的网络服务...

    Linux下基于keepalived的mysql高可用实现方案(HA)

    - **编辑keepalived配置文件**:编辑`/etc/keepalived/keepalived.conf`,添加以下内容: ```ini global_defs { router_id Mysql-HA } vrrp_instance VI_1 { state BACKUP interface ens192 virtual_...

    linux系统keepalived安装包

    - 安装完成后,需要编辑配置文件`/etc/keepalived/keepalived.conf`,设置虚拟IP地址、监控的服务和切换规则。 2. **配置文件详解**: - `vrrp_instance`:定义一个VRRP实例,用于配置虚拟路由的参数,如虚拟IP、...

    linux下keepalived高可用

    ### Linux 下 Keepalived 实现高可用性配置详解 #### 一、背景介绍 随着互联网技术的迅猛发展,用户对于网站和服务的要求也越来越高,其中稳定性是最重要的考量之一。为了提高系统的稳定性和可用性,通常会采用高...

    LVS+KEEPalived 配置

    **LVS+Keepalived配置步骤** 1. **安装LVS和Keepalived**:首先在所有涉及的服务器上安装LVS和Keepalived软件包,如`apt-get install lvs keepalived`(对于Debian/Ubuntu)或`yum install lvs keepalived`(对于...

    keepalived1.2.19 for linux

    本文将深入探讨keepalived 1.2.19版本在Linux环境中的应用,以及如何进行安装和配置。 首先,keepalived是基于VRRP(Virtual Router Redundancy Protocol)协议的,该协议用于在网络中创建虚拟路由器,提供冗余和...

    keepalived配置及典型应用案例

    【标题】"Keepalived配置及...总的来说,"keepalived配置及典型应用案例"是一个关于如何设置和利用Keepalived实现高可用性的教程,包括了Keepalived的配置详解、健康检查脚本的应用以及在实际业务场景中的实践案例。

    keepalived 详细配置文件

    #### Keepalived配置要点 1. **安装Keepalived**:可以通过编译安装或使用包管理器安装。例如,在给定文件中提到了下载`keepalived-1.1.19.tar.gz`,并进行了编译安装的过程。 2. **配置文件解析**:Keepalived的...

    linux lvs keepalived较为详细的安装配置文档

    Linux LVS + Keepalived 详细安装配置文档 LVS(Linux Virtual Server)是一种开源的负载均衡解决方案,可以将多个服务器组成一个高性能、高可用的虚拟服务器。Keepalived 是一个基于 LVS 的高可用性解决方案,提供...

    keepalived-linux安装包

    在描述中提到"这是keepalived-linux下的安装包",意味着这个压缩文件包含了在Linux环境下安装和配置Keepalived所需的所有组件和文档。通常,一个开源软件的tar.gz压缩包会包含源代码、README文件、配置脚本、示例...

    Haproxy+keepalived配置文档

    在构建高可用性服务时,`Haproxy` 和 `Keepalived` 是两种非常重要的工具,它们在Linux环境中广泛用于实现负载均衡和故障切换。`Haproxy` 是一个高性能的TCP/HTTP负载均衡器,而`Keepalived` 提供了VRRP(Virtual ...

    keepalived-2.0.19.tar.gz

    运维人员在部署和配置keepalived时,需要注意网络配置、VRRP优先级设置、健康检查策略以及故障切换的时间窗口等关键参数。合理的配置不仅能确保服务的顺畅,还能避免不必要的资源浪费。 总的来说,`keepalived-...

    linux安装nginx+keepalived,和tomcat负载均衡配置,动静分离配置,主备和双主模式

    本教程将详细讲解如何在Linux系统上安装Nginx、Keepalived,并进行Tomcat的负载均衡配置,以及动静分离的设置,涵盖主备模式和双主模式。通过实践这些步骤,你可以提升服务器的稳定性和性能。 首先,我们需要安装...

    keepalived配置

    【标题】:Keepalived配置详解 【描述】:Keepalived是一款开源的网络和系统守护进程,主要用于实现高可用性(HA)集群环境中的负载均衡和故障切换。它主要结合了VRRP(Virtual Router Redundancy Protocol,虚拟...

    linux基于keepalived的mysql双机热备实现方案(详细过程完整版)

    六、Keepalived配置 1. 安装Keepalived:在两台服务器上安装Keepalived,确保心跳检测和故障切换功能。 2. 配置Keepalived:设置虚拟IP、VIP漂移规则、监控脚本等,确保在主服务器故障时,VIP能够迅速转移到备用...

Global site tag (gtag.js) - Google Analytics