zoukankan      html  css  js  c++  java
  • keepalived 配置vip 漂移

    安装keepalived

    源码包安装keepalived

    源码包下载安装
        [root@master src]# pwd
        /usr/local/src
        [root@master src]# wget http://www.keepalived.org/software/keepalived-2.0.7.tar.gz
        [root@master src]# tar xvf keepalived-2.0.7.tar.gz
        [root@master src]# cd keepalived-2.0.7
        [root@master keepalived-2.0.7]# ./configure --prefix=/usr/local/keepalived
        [root@master keepalived-2.0.7]# make && make install
    完成后会在以下路径生成:
        /usr/local/etc/keepalived/keepalived.conf
        /usr/local/etc/sysconfig/keepalived
        /usr/local/sbin/keepalived
    初始化及启动
        # keepalived启动脚本变量引用文件,默认文件路径是/etc/sysconfig/,也可以不做软链接,直接修改启动脚本中文件路径即可(安装目录下)
        [root@localhost /]# cp /usr/local/keepalived/etc/sysconfig/keepalived  /etc/sysconfig/keepalived 
        # 将keepalived主程序加入到环境变量(安装目录下)
        [root@localhost /]# cp /usr/local/keepalived/sbin/keepalived /usr/sbin/keepalived
        # keepalived启动脚本(源码目录下),放到/etc/init.d/目录下就可以使用service命令便捷调用
        [root@localhost /]# cp /usr/local/src/keepalived-2.0.7/keepalived/etc/init.d/keepalived  /etc/init.d/keepalived
        # 将配置文件放到默认路径下
        [root@localhost /]# mkdir /etc/keepalived
        [root@localhost /]# cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf
    

    以上安装参考于:https://blog.csdn.net/bbwangj/article/details/80346428

    报错

    安装报错

    1.1 configure: error: no acceptable C compiler found in $PATH

    [root@localhost keepalived-1.3.5]# ./configure
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking whether make supports nested variables... (cached) yes
    checking for pkg-config... /usr/bin/pkg-config
    checking pkg-config is at least version 0.9.0... yes
    checking for gcc... no
    checking for cc... no
    checking for cl.exe... no
    configure: error: in `/root/keepalived-1.3.5':
    configure: error: no acceptable C compiler found in $PATH
    See `config.log' for more details
    
    

    原因:安装GCC软件套件
    yum install gcc

    1.2 checking openssl/ssl.h usability... no

    checking whether ETHERTYPE_IPV6 is declared... yes
    checking openssl/ssl.h usability... no
    checking openssl/ssl.h presence... no
    checking for openssl/ssl.h... no
    configure: error:
      !!! OpenSSL is not properly installed on your system. !!!
      !!! Can not include OpenSSL headers files.            !!!
    

    原因:缺少openssl软件包
    yum -y install openssl-devel

    无法启动

    1. pdi file /var/run/keepalived.pid not readable (yet?) after start.

    原因:存在僵尸进程pid。

    杀掉僵尸进程
    ps -ef|grep keepalived
     ps aux    | grep  keepalived  | grep -v grep | awk '{print $2}'| xargs kill
    重启: systemctl keepalived restart
    
  • 相关阅读:
    云图小助理
    ping包的checksum校验和
    ftp相关
    初始化字符串
    安全的域名解析
    10进制转62进制
    centos6一键安装WordPress
    CEF3编译
    一次性生产KEY
    linux系统问题排查
  • 原文地址:https://www.cnblogs.com/Leo-Cjh/p/13666491.html
Copyright © 2011-2022 走看看