安装完keepalived后设置为服务自启动

将路径为/usr/local/src/keepalived-1.3.4/keepalived/etc/init.d的文件keepalived拷贝到/etc/init.d下

cp /usr/local/src/keepalived-1.3./keepalived/etc/init.d/keepalived /etc/init.d/

将路径为/usr/local/keepalived-1.3.4/etc/sysconfig/keepalived的文件拷贝到 /etc/sysconfig/keepalived

cp /usr/local/keepavlied-1.3./etc/sysconfig/keepalived  /etc/sysconfig/

添加执行权限

chmod +x /etc/init.d/keepalived

添加keepalived到系统服务

chkconfig --add keepalived

启动

[root@localhost ~]# service keepalived start
Starting keepalived (via systemctl): Job for keepalived.service failed because the control process exited with error code. See "systemctl status keepalived.service" and "journalctl -xe" for details.
[失败]

报错,启动失败,用status查看具体原因

[root@localhost ~]# systemctl status keepalived
● keepalived.service - LVS and VRRP High Availability Monitor
Loaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 -- :: CST; 24s ago
Process: ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=/EXEC) 4月 :: localhost.localdomain systemd[]: Starting LVS and VRRP High Availability Monitor...
4月 :: localhost.localdomain systemd[]: keepalived.service: control process exited, code=ex...
4月 :: localhost.localdomain systemd[]: Failed to start LVS and VRRP High Availability Monitor.
4月 :: localhost.localdomain systemd[]: Unit keepalived.service entered failed state.
4月 :: localhost.localdomain systemd[]: keepalived.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

提示:ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=203/EXEC)

查看ll /usr/sbin/keepalived 文件不存在,此时有两种方法解决

1、复制一个keepalived到/usr/sbin/ 下

2、修改 /lib/systemd/system/keepalived.service文件,将 /usr/sbin/路径改成我们存放keepalived文件的路径

[root@localhost ~]# vi /lib/systemd/system/keepalived.service

[Unit]
Description=LVS and VRRP High Availability Monitor
After=syslog.target network-online.target [Service]
Type=forking
PIDFile=/var/run/keepalived.pid
KillMode=process
EnvironmentFile=-/etc/sysconfig/keepalived
ExecStart=/usr/local/bin/keepalived $KEEPALIVED_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID [Install]

3、生效

systemctl daemon-reload

4、再启动

[root@localhost keepalived-1.3.]# systemctl start keepalived
[root@localhost keepalived-1.3.]# systemctl status keepalived
● keepalived.service - LVS and VRRP High Availability Monitor
Loaded: loaded (/usr/lib/systemd/system/keepalived.service; disabled; vendor preset: disabled)
Active: active (running) since 四 -- :: CST; 2s ago
Process: ExecStart=/usr/local/bin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=/SUCCESS)
Main PID: (keepalived)
CGroup: /system.slice/keepalived.service
├─ /usr/local/bin/keepalived -D
├─ /usr/local/bin/keepalived -D
└─ /usr/local/bin/keepalived -D 4月 :: localhost.localdomain Keepalived_vrrp[]: VRRP_Instance(VI_1) Changing effective p...
4月 :: localhost.localdomain Keepalived_vrrp[]: VRRP_Instance(VI_1) Entering MASTER STATE
4月 :: localhost.localdomain Keepalived_vrrp[]: VRRP_Instance(VI_1) setting protocol VIPs.
4月 :: localhost.localdomain Keepalived_healthcheckers[]: Netlink reflector reports IP ...d
4月 :: localhost.localdomain Keepalived_vrrp[]: Sending gratuitous ARP on em1 for 172.28...
4月 :: localhost.localdomain Keepalived_vrrp[]: VRRP_Instance(VI_1) Sending/queueing gra...
4月 :: localhost.localdomain Keepalived_vrrp[]: Sending gratuitous ARP on em1 for 172.28...
4月 :: localhost.localdomain Keepalived_vrrp[]: Sending gratuitous ARP on em1 for 172.28...
4月 :: localhost.localdomain Keepalived_vrrp[]: Sending gratuitous ARP on em1 for 172.28...
4月 :: localhost.localdomain Keepalived_vrrp[]: Sending gratuitous ARP on em1 for 172.28...
Hint: Some lines were ellipsized, use -l to show in full.

成功

keepalived添加服务自启动报错分析的更多相关文章

  1. rsyslog服务日志报错分析1

    客户问题: 最近对服务器进行日志检查时,发现部分主机的rsyslog服务状态有报错,报错详情如下 排查过程: 1.从报错截图来看,报错主要发生在文件'/usr/lib64/rsyslog/omazur ...

  2. mysql5.7密码修改与报错分析

    1.修改密码 修改密码: vim /etc/my.cnf 的mysqld字段加入skip-grant-tables 重启MySQL,service mysqld restart 终端输入 mysql ...

  3. gitblit在windows10上的安装及服务启动报错处理

    折腾一下午算是装好了,心情不错决定分享一下.安装步骤大同小异网上都有,主要是Failed creating java 这个报错,百度出来的没有一个能给我解决的,摸索半天找出一个自己的方式.为报错而来的 ...

  4. CocoaPods 添加第三方库报错

    1.终端报错:The dependency MBProgressHUD (~> 0.9.2) is not used in any concrete target.2.原因:CocoaPods升 ...

  5. const变量赋值报错分析

    const变量赋值报错分析 const变量赋值报错 从变量到常量的赋值是合法C++的语法约定的, 如从char 到const char顺畅: 但从char **到 const char **编译器就会 ...

  6. std::unique_ptr使用incomplete type的报错分析和解决

    Pimpl(Pointer to implementation)很多同学都不陌生,但是从原始指针升级到C++11的独占指针std::unique_ptr时,会遇到一个incomplete type的报 ...

  7. 【.netcore学习】.netcore添加到 supervisor 守护进程自启动报错

    配置 supervisor [program:HelloWebApp] command=dotnet run directory=/home/python/dotnet/myweb/mywebapi ...

  8. MongoDB添加仲裁节点报错replica set IDs do not match办法

    背景:由于历史原因,某个MongoDB副本集只有一主一从双节点,无法满足自动故障转移要求,需要配置一个仲裁节点. 原有节点192.168.10.20:27017,192.168.10.21:27017 ...

  9. 启动mysql服务,报错1067,进程意外终止

    之前一直使用的是oracle,这次换成mysql,在配置my.ini的时候,添加default-character-set=utf8,来修改字符集. 修改完成之后,启动mysql的服务,但是报错,10 ...

随机推荐

  1. (转)Windows 平台下解决httpd.exe: syntax error on line 39

    近来在研究PHP,结果为了Apache的安装伤神不已...小白我在安装后,启动Apache的服务虽然可以,不过,在Apache sevice monitor 中启动services时就会出现如下的问题 ...

  2. Metabase研究 开源的数据报表

    https://blog.csdn.net/bin330720911/article/details/79273317 https://blog.csdn.net/qq_35902833/articl ...

  3. react的学习笔记

    React中几个核心的概念### 虚拟DOM(Virtual Document Object Model) + **DOM的本质是什么**:浏览器中的概念,用JS对象来表示 页面上的元素,并提供了操作 ...

  4. 进程间传递文件描述符——sendmsg和recvmsg函数

    先引入一个例子,该程序的目的是子进程向父进程传递文件描述符,并通过该文件描述符读取buf. #include <func.h> int main(){ int fds[2]; pipe(f ...

  5. okhttp 解析respone:

    android,retrofit,okhttp,日志拦截器,使用拦截器Interceptor统一打印请求与响应的json: https://blog.csdn.net/qq_37043246/arti ...

  6. 05-Eclispe配置Tomcat插件

    此插件只针对 eclipse-java-indigo-SR2-win32 这个开发工具使用的 1.下载tomcat插件 2.解压到指定位置 3.找到eclispe安装目录 D:\software\ec ...

  7. 学习MeteoInfo二次开发教程(十)

    1.复制文件cloud_1009271330.000,I-01.pal 2.改: GridData cloud = aDataInfo.GetGridData(""); 为: Gr ...

  8. linux 退出当前命令的编辑

    有时候输入命令,linux既不响应命令,也不提示错误.可以用如下方法结束当前命令: ctrl+z挂起当前进程如果需要恢复到前台输入fg,恢复到后台输入bgctrl+c,彻底终止该进程

  9. python函数与模块(装饰器,文件处理,迭代器等)

    os模块 os.system('命令') 利用python调用系统命令,命令可以是以列表或者元组内的元素形式* res import os res=os.system('ipconfig') prin ...

  10. C# 获取指定路径下的文件结构(树形结构)

    namespace Vue.Content { public class FileNames { public int id { get; set; } public string text { ge ...