在linux下安装keepalived的时候,报错configure:error:nftables header files missing,跪求大神解决方案
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在linux下安装keepalived的时候,报错configure:error:nftables header files missing,跪求大神解决方案相关的知识,希望对你有一定的参考价值。
参考技术A 如果是centos,可以使用yum安装,避免补相关包的问题yum install keepalived 参考技术B 为啥不用包管理器?
1.ubuntu apt-get
2.centos yum
3.fedora dnf
这种工具很方便 参考技术C 解决了吗?我也遇到了同样的问题
MySQL之keepalived高可用
参考技术A 使用keepalived做mysql主从切换的高可用keepalived切换的优缺点
1.可以切换虚拟IP
2.可能发生裂脑,就是主从服务器都同时出现一样的VIP,导致写入数据的时候,往主从都写入了数据
3.可能导致主从mysql数据不一致。主在down机的时候,有部分数据还没同步到从mysql
此实验在mysql使用gtid同步实现的前提下的
192.168.209.132 master
192.168.209.131 slave
1.安装keepalived
直接yum安装或者编译安装都可以,生产环境也是ok的
2.配置keepalived的配置文件
keepalived配置文件默认放在/etc/keepalived/文件夹下
如果不把配置文件放这里,那么启动keepalived的时候,需要用参数指定配置文件的位置
这里我用默认安装和默认配置文件位置
192.168.209.132:
vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs
notification_email
router_id SLAVE
vrrp_script chk_mysql
script "/data/script/mysql_check.sh"
interval 2
weight -20
vrrp_instance VI_1
state BACKUP
interface eth0
nopreempt
virtual_router_id 131
priority 100
advert_int 1
authentication
auth_type PASS
auth_pass 1111
virtual_ipaddress
192.168.209.16
track_script
chk_mysql
监控脚本:
vim /data/script/mysql_check.sh
#!/bin/sh
mysqlstr=/usr/local/mysql/bin/mysql
host=localhost
user=root
password=123456
port=33061
mysql_status=1
$mysqlstr -h $host -u $user -p$password -P $port -e "show status;" > /dev/null 2>&1
if [ $? = 0 ] ;then
echo "mysql_status=1"
exit 0
else
pkill keepalived
fi
192.168.209.131:
vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs
notification_email
router_id SLAVE
vrrp_script chk_mysql
script "/data/script/mysql_check.sh"
interval 2
weight -20
vrrp_instance VI_1
state BACKUP
interface eth0
nopreempt
virtual_router_id 131
priority 90
advert_int 1
authentication
auth_type PASS
auth_pass 1111
virtual_ipaddress
192.168.209.16
track_script
chk_mysql
配置文件:
vim /data/script/mysql_check.sh
#!/bin/sh
mysqlstr=/usr/local/mysql/bin/mysql
host=localhost
user=root
password=123456
port=33061
mysql_status=1
$mysqlstr -h $host -u $user -p$password -P $port -e "show status;" > /dev/null 2>&1
if [ $? = 0 ] ;then
echo "mysql_status=1"
exit 0
else
pkill keepalived
fi
对实验结果开始进行验证
192.168.209.132上获取到vip
把192.168.209.132上的mysqld给干掉
查看192.168.209.132上的mysqld和keepalived进程是否都被干掉了;虚拟IP是否切换到192.168.209.131上了
查看192.168.209.131上是否有VIP
把192.168.209.132上的keepalived和mysqld都启动起来。先启mysqld再起keepalived
此时keepalived启动起来了,虽然权重比192.168.209.131的高,但是设置了不抢夺,所以192.168.209.132上的keepalived不会切换vip过来
此时,把192.168.209.131上的mysql停掉它
查看131上的mysql和keepalived是否已经都停止了
查看192.168.209.132上是否有VIP了
以上是关于在linux下安装keepalived的时候,报错configure:error:nftables header files missing,跪求大神解决方案的主要内容,如果未能解决你的问题,请参考以下文章