Keeplived安装部署(单机双机)

Keeplived官网:https://www.keepalived.org/download.html

一 单机安装配置:

1.上传keepalived安装包并且安装

[root@master1 local]# tar -zxvf keepalived-2.2.8.tar.gz
[root@master1 local]# mv keepalived-2.2.8 keepalived
[root@master1 local]# chown root:root -R keepalived
[root@master1 local]# cd keepalived
[root@master1 keepalived]# ./configure --prefix=/usr/local/keepalived
[root@master1 keepalived]# make && make install
[root@master1 keepalived]# ls
aclocal.m4  autogen.sh  bin_install  build_setup  config.log     configure     CONTRIBUTORS  doc         Dockerfile.in  INSTALL     keepalived.spec     lib  Makefile     Makefile.in  README.md  share  TODO
AUTHOR      bin         build-aux    ChangeLog    config.status  configure.ac  COPYING       Dockerfile  etc            keepalived  keepalived.spec.in  m4   Makefile.am  README       sbin       snap   tools

2.修改配置

[root@master1 keepalived]# cd etc/keepalived/
[root@master1 keepalived]# ls
keepalived.conf.sample  samples
[root@master1 keepalived]# cp keepalived.conf.sample keepalived.conf
[root@master1 keepalived]# ls
keepalived.conf  keepalived.conf.sample  samples

3.添加系统启动项

vim /lib/systemd/system/keepalived.service
[Unit]
Description=LVS and VRRP High Availability Monitor
After=network-online.target syslog.target
Wants=network-online.target
Documentation=man:keepalived(8)
Documentation=man:keepalived.conf(5)
Documentation=man:genhash(1)
Documentation=https://keepalived.org[Service]
Type=forking
PIDFile=/run/keepalived.pid
KillMode=process
EnvironmentFile=-/usr/local/keepalived/etc/sysconfig/keepalived
ExecStart=/usr/local/keepalived/sbin/keepalived  $KEEPALIVED_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID[Install]
WantedBy=multi-user.target
重新加载配置:
systemctl daemon-reload设置开机启动:
cp /usr/local/keepalived/sbin/keepalived /etc/init.d/keepalived
systemctl enable keepalived启动命令:
systemctl start keepalived
systemctl status keepalived
systemctl restart keepalived

启动和相关报错:

[root@master1 etc]# systemctl start keepalived
[root@master1 keepalived]# systemctl status keepalived
● keepalived.service - LVS and VRRP High Availability MonitorLoaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)Active: failed (Result: exit-code) since 四 2023-10-19 18:05:36 CST; 3s agoDocs: man:keepalived(8)man:keepalived.conf(5)man:genhash(1)https://keepalived.orgProcess: 110509 ExecStart=/usr/local/keepalived/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)Main PID: 110510 (code=exited, status=2)Tasks: 0Memory: 0BCGroup: /system.slice/keepalived.service10月 19 18:05:36 master1 Keepalived[110510]: NOTICE: setting config option max_auto_priority should result in better keepalived performance
10月 19 18:05:36 master1 Keepalived[110510]: Starting Healthcheck child process, pid=110511
10月 19 18:05:36 master1 Keepalived[110510]: Starting VRRP child process, pid=110512
10月 19 18:05:36 master1 Keepalived_healthcheckers[110511]: Initializing ipvs
10月 19 18:05:36 master1 systemd[1]: keepalived.service: main process exited, code=exited, status=2/INVALIDARGUMENT
10月 19 18:05:36 master1 systemd[1]: Unit keepalived.service entered failed state.
10月 19 18:05:36 master1 systemd[1]: keepalived.service failed.
10月 19 18:05:36 master1 Keepalived_healthcheckers[110511]: Gained quorum 1+0=1 <= 1 for VS [192.168.200.100]:tcp:443
10月 19 18:05:36 master1 Keepalived_healthcheckers[110511]: Gained quorum 1+0=1 <= 2 for VS [10.10.10.2]:tcp:1358
10月 19 18:05:36 master1 Keepalived_healthcheckers[110511]: Gained quorum 1+0=1 <= 2 for VS [10.10.10.3]:tcp:1358

需要修改虚拟ip等配置:

[root@master1 keepalived]# tail -f /var/log/messagesOct 19 18:07:04 master1 grafana: logger=plugins.update.checker t=2023-10-19T18:07:04.752278809+08:00 level=info msg="Update check succeeded" duration=6.432745249s
Oct 19 18:07:06 master1 systemd: Starting LVS and VRRP High Availability Monitor...
Oct 19 18:07:06 master1 Keepalived[110735]: Starting Keepalived v2.2.8 (04/04,2023), git commit v2.2.7-154-g292b299e+
Oct 19 18:07:06 master1 Keepalived[110735]: Running on Linux 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 (built for Linux 3.10.0)
Oct 19 18:07:06 master1 Keepalived[110735]: Command line: '/usr/local/keepalived/sbin/keepalived' '-D'
Oct 19 18:07:06 master1 Keepalived[110735]: Opening file '/usr/local/keepalived/etc/keepalived/keepalived.conf'.
Oct 19 18:07:06 master1 Keepalived[110735]: Configuration file /usr/local/keepalived/etc/keepalived/keepalived.conf
Oct 19 18:07:06 master1 systemd: Started LVS and VRRP High Availability Monitor.
Oct 19 18:07:06 master1 Keepalived[110735]: (Line 15) WARNING - number '0' outside range [0.000001, 4294.967295]
Oct 19 18:07:06 master1 Keepalived[110735]: (Line 15) vrrp_garp_interval '0' is invalid
Oct 19 18:07:06 master1 Keepalived[110735]: (Line 16) WARNING - number '0' outside range [0.000001, 4294.967295]
Oct 19 18:07:06 master1 Keepalived[110735]: (Line 16) vrrp_gna_interval '0' is invalid
Oct 19 18:07:06 master1 Keepalived[110736]: NOTICE: setting config option max_auto_priority should result in better keepalived performance
Oct 19 18:07:06 master1 Keepalived[110736]: Starting Healthcheck child process, pid=110737
Oct 19 18:07:06 master1 Keepalived[110736]: Starting VRRP child process, pid=110738
Oct 19 18:07:06 master1 Keepalived_vrrp[110738]: Registering Kernel netlink reflector
Oct 19 18:07:06 master1 systemd: keepalived.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 19 18:07:06 master1 Keepalived_vrrp[110738]: Registering Kernel netlink command channel
Oct 19 18:07:06 master1 systemd: Unit keepalived.service entered failed state.
Oct 19 18:07:06 master1 Keepalived_vrrp[110738]: (/usr/local/keepalived/etc/keepalived/keepalived.conf: Line 21) WARNING - interface eth0 for vrrp_instance VI_1 doesn't exist
Oct 19 18:07:06 master1 systemd: keepalived.service failed.
Oct 19 18:07:06 master1 Keepalived_vrrp[110738]: Non-existent interface specified in configuration
Oct 19 18:07:06 master1 Keepalived_vrrp[110738]: Stopped - used 0.000000 user time, 0.001848 system time
Oct 19 18:07:06 master1 Keepalived[110736]: pid 110738 exited with permanent error CONFIG. Terminating
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Gained quorum 1+0=1 <= 1 for VS [192.168.200.100]:tcp:443
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Gained quorum 1+0=1 <= 2 for VS [10.10.10.2]:tcp:1358
Oct 19 18:07:06 master1 Keepalived[110736]: CPU usage (self/children) user: 0.000000/0.000000 system: 0.001606/0.002565
Oct 19 18:07:06 master1 Keepalived[110736]: Stopped Keepalived v2.2.8 (04/04,2023), git commit v2.2.7-154-g292b299e+
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Gained quorum 1+0=1 <= 2 for VS [10.10.10.3]:tcp:1358
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Activating healthchecker for service [192.168.201.100]:tcp:443 for VS [192.168.200.100]:tcp:443
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Activating healthchecker for service [192.168.200.2]:tcp:1358 for VS [10.10.10.2]:tcp:1358
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Activating healthchecker for service [192.168.200.3]:tcp:1358 for VS [10.10.10.2]:tcp:1358
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Activating healthchecker for service [192.168.200.4]:tcp:1358 for VS [10.10.10.3]:tcp:1358
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Activating healthchecker for service [192.168.200.5]:tcp:1358 for VS [10.10.10.3]:tcp:1358
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Shutting down service [192.168.201.100]:tcp:443 from VS [192.168.200.100]:tcp:443
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Shutting down service [192.168.200.2]:tcp:1358 from VS [10.10.10.2]:tcp:1358
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Shutting down service [192.168.200.3]:tcp:1358 from VS [10.10.10.2]:tcp:1358
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Shutting down service [192.168.200.4]:tcp:1358 from VS [10.10.10.3]:tcp:1358
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Shutting down service [192.168.200.5]:tcp:1358 from VS [10.10.10.3]:tcp:1358
Oct 19 18:07:06 master1 Keepalived_healthcheckers[110737]: Stopped - used 0.001620 user time, 0.001620 system time
[root@master1 keepalived]# vim keepalived.conf
! Configuration File for keepalivedglobal_defs {notification_email {acassen@firewall.locfailover@firewall.locsysadmin@firewall.loc}notification_email_from Alexandre.Cassen@firewall.locsmtp_server 192.168.200.1smtp_connect_timeout 30router_id LVS_DEVELvrrp_skip_check_adv_addrvrrp_strictvrrp_garp_interval 0vrrp_gna_interval 0
}vrrp_instance VI_1 {state MASTERinterface ens32 #这个是根据ip address来的,就是本机的网卡名称virtual_router_id 51priority 100advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {10.10.10.33 #这个地址是根据原来机器的ip来的,比如原ip:10.10.10.10,虚拟ip写成10.10.10.33或其他的,还可以配置多个虚拟ip10.10.10.3410.10.10.35}
}

测试:

1.需要安装nginx并且配置(nginx自己安装)

[root@master1 conf]# cd /usr/local/nginx/html
[root@master1 html]# vim test.html
this is a test url!
vim nginx.conf

 测试结果:

 二 双机安装配置:

待续...

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/111856.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Selenium定向爬取海量精美图片及搜索引擎杂谈

我自认为这是自己写过博客中一篇比较优秀的文章,同时也是在深夜凌晨2点满怀着激情和愉悦之心完成的。首先通过这篇文章,你能学到以下几点: 1.可以了解Python简单爬取图片的一些思路和方法 2.学习Selenium自动、测试分析动态网页和正则表达式的区别和共同点 …

智能井盖是什么?万宾科技智能井盖传感器有什么特点

智能井盖是一种基于物联网和人工智能技术的新型城市设施。它不仅具备传统井盖的功能&#xff0c;还能通过数字化、自动化的方式实现远程监控和智能管理&#xff0c;提升城市运行效率和服务水平。 WITBEE万宾智能井盖传感器EN100-C2是一款井盖异动监测的传感终端。对窨井盖状态(…

分享一下微信公众号抽奖活动怎么弄

微信公众号抽奖活动是一种非常有效的营销手段&#xff0c;可以吸引大量用户参与&#xff0c;提高品牌曝光度和用户粘性。下面将介绍如何策划和实施一个成功的微信公众号抽奖活动。 一、明确活动目的 首先&#xff0c;需要明确微信公众号抽奖活动的目的。通常&#xff0c;抽奖活…

同花顺动态Cookie反爬JS逆向分析

文章目录 1. 写在前面2. 请求分析3. Hook Cookie4. 补环境 1. 写在前面 最近有位朋友在大A失意&#xff0c;突发奇想自己闲来无事想要做一个小工具&#xff0c;监测一下市场行情的数据。自己再分析分析&#xff0c;虽是一名程序员但苦于对爬虫领域相关的技术不是特别熟悉。最后…

万宾科技智能井盖传感器特点介绍

当谈论城市基础设施的管理和安全时&#xff0c;井盖通常不是第一项引人注目的话题。然而&#xff0c;传统井盖和智能井盖传感器之间的差异已经引起了城市规划者和工程师的广泛关注。这两种技术在功能、管理、安全和成本等多个方面存在着显著的差异。 WITBEE万宾智能井盖传感器E…

Docker Compose和Consul

目录 Docker-compose Docker-compose 简介 YAML 文件格式及编写注意事项 Docker Compose配置常用字段 Docker Compose 常用命令 Docker Compose 文件结构 compose 部署 Docker Compose 环境安装 准备依赖文件 编写配置文件docker-compose.yml Consul consul 部署 c…

bug记录——设置了feign的fallback,但是没有生效

问题描述 feign的代码 package com.tianju.order.feign;import com.tianju.order.feign.fallback.StorageFallback; import com.tinaju.common.dto.GoodsDto; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMap…

JS中改变this指向的六种方法

大家肯定为this指向的问题感到烦恼&#xff0c;接下来让我为大家介绍六种改变this指向的方法吧&#xff01; 1、在指定位置定义this存为变量 // 在指定位置定义this存为变量// 我们可以自己存一个变量let _this thisconst obj {fun(){console.log(_this) //window}}obj.fun(…

Edge---微软浏览器-兼容性问题-解决办法(详细)

图片现象&#xff1a; 快捷键&#xff1a;winR &#xff08;进入管理员命令窗口&#xff09; 输入&#xff1a;regedit &#xff08;进入注册表编辑器&#xff09; 点击文件夹&#xff1a;HKEY_LOCAL_MACHINE 找到这个路径的文件项&#xff1a;HKEY_LOCAL_MACHINE\SOFTWARE…

web前端面试-- IEEE754标准JS精度丢失问题0.1+0.2!=0.3、0.2+0.3==0.5 十进制转二进制讲解

本人是一个web前端开发工程师&#xff0c;主要是vue框架&#xff0c;整理了一些面试题&#xff0c;今后也会一直更新&#xff0c;有好题目的同学欢迎评论区分享 ;-&#xff09; web面试题专栏&#xff1a;点击此处 背景 WEB前端面试官&#xff1a;0.20.3是否等于0.5&#xff…

JDBC-day06(数据库连接池)

八&#xff1a;数据库连接池 1. 传统连接数据库的模式 在使用开发基于数据库的web程序时&#xff0c;传统的模式基本是按以下步骤&#xff1a; 在主程序&#xff08;如servlet、bea&#xff0c;ns&#xff09;中建立数据库连接进行sql操作断开数据库连接 传统的模式存在的问…

zookeeper(目前只有安装)

安装 流程 学kafka的时候安装 Apache ZooKeeper 安装地址&#xff1a;https://archive.apache.org/dist/zookeeper/zookeeper-3.5.7/apache-zookeeper-3.5.7-bin.tar.gz 解压 tar -zxvf kafka_2.12-3.0.0.tgz -C /export/server/ 改配置 cd config cp zoo_sample.cfg z…

一、vue介绍

一、介绍 vue式前端框架&#xff0c;是一套用于构建用户界面的渐进式框架 1、安装vue 安装node.js&#xff08;配置环境变量&#xff09; https://nodejs.org/en/download/ 更换镜像 npm config set registry https://registry.npm.taobao.org 查看镜像 npm config get regi…

Pixhawk 6c (PX4)真机USB连接mavros失败

概述 笔者和同事近期购买了Pixhawk6c&#xff0c;它也是目前Pixhawk系列中最新的飞控。 但是在测试的过程中遇到了一个问题&#xff0c;发现它无法连接到mavros。 于是进行了一系列原因摸排&#xff0c;在国内的博客尚未看到能用的解决方案&#xff0c;在px4论坛上倒是找到了答…

VUE:侧边弹出栏组件,组件中有树状图,搜索框可筛选树状图节点,可收缩

作者:CSDN @ _乐多_ 本文记录了一个侧边弹出栏组件代码。代码即插即用。 弹出栏中有树状图,搜索框,可收缩。 其中,搜索框可筛选树状图节点。点击右侧小按钮可以收缩弹出框,点击X号也可以收缩弹出框。 文章目录 一、组件代码代码依赖element-plus库。且需要下载几个svg图…

Hadoop分布式计算框架-MapReduce

本文所有代码链接:https://download.csdn.net/download/shangjg03/88437313 1.MapReduce概述 Hadoop MapReduce 是一个分布式计算框架,用于编写批处理应用程序。编写好的程序可以提交到 Hadoop 集群上用于并行处理大规模的数据集。 MapReduce 作业通过将输入的数据集拆分为独…

FUNCTION 表示 getter setter

场景&#xff1a; 某些时候&#xff0c;会对同一个对象的多个不同属性做相同操作&#xff0c;代码复用原则&#xff0c;可以把 getter setter 用 FUNCTION 表示&#xff1b; import java.util.function.BiConsumer;import java.util.function.Function;private static void res…

采集数据重复解决方法

在大数据采集或大批量采集文章时&#xff0c;有可能会出现数据重复&#xff0c;而重复数据会导致数据分析出现偏差甚至错误&#xff0c;如何避免采集数据重复是个值得研究的问题。 目录 1. 优化采集方案 2. 过滤去重规则 3. 比对算法 4. 数据采集工具 减少采集数据重复的常…

grafana v10.1版本设置告警

1. 相关概念概述 如图所示&#xff0c;点击切换菜单标志&#xff0c;可以看到警报相关子选项。 警报规则&#xff1a;通过PromQL语句定义告警规则&#xff0c;即达到怎样的状态触发告警。 联络点&#xff1a; 设置当警报规则实例触发时&#xff0c;如何通知联系人&#xff0c;…

AI杀疯!2023上半年至今有趣的AI算法(内附视频)

公众号&#xff1a;算法一只狗 文章目录 第一个&#xff0c;一切都可以进行分割第二个&#xff0c;开源图文回答工具第三个&#xff0c;视频转换风格生成第四个&#xff0c;免费好用的文档对话工具文档对话能力文档联系功能 今年&#xff0c;我们见证了人工智能算法的起飞&…