CentOS7编译安装Keepalived2.0.19
实验环境:centos7
节点1:10.15.192.21
节点2:10.15.192.22
vip地址:10.15.192.23
1、下载文件
cd /usr/local/src
wget https://www.keepalived.org/software/keepalived-2.0.19.tar.gz
# 官网地址 https://www.keepalived.org/download.html
2、解压文件
tar xzf keepalived-2.0.19.tar.gz
cd keepalived-2.0.19
3、安装依赖
yum -y install libnl libnl-devel openssl-devel
4、初始化配置
cd keepalived-2.0.19/
./configure --prefix=/usr/local/keepalived
5、编译安装
make && make install
6、配置
mkdir /etc/keepalived
cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
cp /usr/local/keepalived/sbin/keepalived /etc/init.d/
节点1配置文件如下,注意两个节点mcast_src_ip 和 priority 值
cat keepalived.conf
! Configuration File for keepalived global_defs {
router_id hf-ayd-web-balance-01
script_user root
enable_script_security
} 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 151
mcast_src_ip 10.15.192.21
priority 100
advert_int 1
nopreempt authentication {
auth_type PASS
auth_pass 1111
} virtual_ipaddress {
10.15.192.23
} track_script {
chk_nginx
}
}
节点2配置文件如下
cat keepalived.conf
! Configuration File for keepalived global_defs {
router_id hf-ayd-web-balance-02
script_user root
enable_script_security
} 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 151
mcast_src_ip 10.15.192.22
priority 90
advert_int 1
nopreempt authentication {
auth_type PASS
auth_pass 1111
} virtual_ipaddress {
10.15.192.23
} track_script {
chk_nginx
}
}
7、管理服务
systemctl start keepalived #启动
systemctl restart keepalived #重启
systemctl stop keepalived #关闭
systemctl status keepalived # 状态
常见问题一:keepalived配置nopreempt参数无效解决方法
nopreempt #设置为不抢占 注:这个配置只能设置在backup主机上,而且这个主机优先级要比另外一台高
master不能设置nopreempt
解决方案是:不设置master,全部设置成backup,这样大家都是backup,就都能添加nopreempt,即使原本成为master的LB坏掉重新修好之后也不会抢占master。
通常如果master服务死掉后backup会变成master,但是当master服务又好了的时候 master此时会抢占VIP,这样就会发生两次切换对业务繁忙的网站来说是不好的。所以我们要在配置文件加入 nopreempt 非抢占,但是这个参数只能用于state 为backup,故我们在用HA的时候最好master 和backup的state都设置成backup 让其通过priority来竞争
常见问题二:编译安装keepalived时提示以下错误
make
cd . && /bin/sh /data/keepalived-2.0.19/missing automake-1.15 --foreign Makefile
/data/keepalived-2.0.19/missing: line 81: automake-1.15: command not found
WARNING: 'automake-1.15' is missing on your system.
You should only need it if you modified 'Makefile.am' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'automake' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
make: *** [Makefile.in] Error 127
解决方法如下:
yum install automake -y
autoreconf -ivf
再次执行make
编译报错问题安装参考:https://blog.csdn.net/arackethis/article/details/42222905
部署参考:https://www.cnblogs.com/gray13/p/11690590.html
CentOS7编译安装Keepalived2.0.19的更多相关文章
- 编译安装Keepalived2.0.0
简介 Keepalived是基于vrrp协议的一款高可用软件.Keepailived有一台主服务器和多台备份服务器,在主服务器和备份服务器上面部署相同的服务配置,使用一个虚拟IP地址对外提供服务,当主 ...
- 编译安装 keepalived-2.0.16.tar.gz
一.下载安装包 wget https://www.keepalived.org/software/keepalived-2.0.16.tar.gz 安装相关依赖 把所有的rpm包放在一个目录下. rp ...
- CentOS7编译安装MySQL8.0
1.下载mysql8.0.16源码包和cmake源码包 cd /usr/local/srcwget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-b ...
- centos7 二进制安装mysql-8.0.19
安装包下载地址:https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz 1.检 ...
- Centos7编译安装kafka-manager-2.0.0.2
一.kafka-manager简介 项目地址为:https://github.com/yahoo/kafka-manager 为了简化开发者和服务工程师维护Kafka集群的工作,yahoo构建了一个叫 ...
- centos7 编译安装 redis-6.0.5
安装redis sudo yum install redis centos自带的redis才3.2 太旧了所以使用源码编译 需要先安装gcc新版才能编译 centos7 默认的 gcc 版本为:4.8 ...
- Centos7编译安装zabbix-4.0.1
架构组合:nginx1.9.10+php7.0.32+mysql5.7.22+zabbix4.0.1 nginx1.9.10 先装依赖 openssl-1.1.0f tar zxvf openssl- ...
- centos7编译安装pure-ftpd-1.0.42
一.下载 wget https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.42.tar.gz 二.安装 tar xvf ...
- centos7下编译安装php-7.0.15(PHP-FPM)
centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...
随机推荐
- [LeetCode] 337. House Robber III 打家劫舍之三
The thief has found himself a new place for his thievery again. There is only one entrance to this a ...
- [LeetCode] 17. Letter Combinations of a Phone Number 电话号码的字母组合
Given a string containing digits from 2-9inclusive, return all possible letter combinations that the ...
- 【微信小程序】小程序中的函数节流
大ga吼! 很久没写博客咯,今天学到了一点新知识, 记录分享一下~ 摘要: 小程序中的函数节流 场景: 从商城列表进入商品详情中时,或者生成,提交订单, 付款的时候, 若用户快速点击(一秒8键,母胎s ...
- luogu P5605 小 A 与两位神仙 - 原根
题目传送门 传送门 Subtask 1 直接模拟. Subtask 2 BSGS算法模板. Subtask 3 考虑模 $m$ 的任意一个原根 $g$. 假设 $g^{ra} \equiv x \pm ...
- (98)address already in use: ah00072: make_sock: could not bind to address 0.0.0.0:80
(98)address already in use: ah00072: make_sock: could not bind to address 0.0.0.0:80 问题描述: 80端口已经被占用 ...
- Spring AOP环绕异常影响的报错
最近遇到一个问题,异常是: java.lang.ClassCastException: org.springframework.http.ResponseEntity cannot be cast t ...
- Unity和Jenkins真是绝配,将打包彻底一键化!
说起打包,我们的QA简直是要抓狂,这个确实我也很同情他们.项目最开始打包是另一个同事做的,打包步骤是有些繁琐,但是项目上线后,不敢轻易动啊!每次他们打包总要跟我抱怨,国内版本打包步骤要10多步还能忍, ...
- centos上安装grafana
wget https://dl.grafana.com/oss/release/grafana-6.2.5-1.x86_64.rpm yum localinstall grafana-6.2.5-1. ...
- 通过IP获取MAC地址例子(应用层)
博客地址:http://home.cnblogs.com/u/zengjianrong/ 由于某种需求,需要获取某个ip的mac地址,在应用层实现例子如下代码. 流程:1. 先遍历arp表,若存在对应 ...
- commitizen规范代码提交
转载链接:https://www.jianshu.com/p/bd712e42f2e9 参考链接:https://segmentfault.com/a/1190000009048911 平时提交的变动 ...