After installing keepalived, set it to start the service automatically
Copy the file keepalived whose path is /usr/local/src/keepalived-1.3.4/keepalived/etc/init.d to /etc/init.d
cp /usr/local/src/keepalived-1.3.4/keepalived/etc/init.d/keepalived /etc/init.d/
Copy the file whose path is /usr/local/keepalived-1.3.4/etc/sysconfig/keepalived to /etc/sysconfig/keepalived
cp /usr/local/keepavlied-1.3.4/etc/sysconfig/keepalived /etc/sysconfig/
Add execute permission
chmod +x /etc/init.d/keepalived
Add keepalived to the system service
chkconfig --add keepalived
start up
[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.
[failure]
Report an error, start failure, use status to check the specific reason
[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 四 2019-04-25 14:25:01 CST; 24s ago Process: 17642 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=203/EXEC) 4月 25 14:25:01 localhost.localdomain systemd[1]: Starting LVS and VRRP High Availability Monitor... 4月 25 14:25:01 localhost.localdomain systemd[1]: keepalived.service: control process exited, code=ex...203 4月 25 14:25:01 localhost.localdomain systemd[1]: Failed to start LVS and VRRP High Availability Monitor. 4月 25 14:25:01 localhost.localdomain systemd[1]: Unit keepalived.service entered failed state. 4月 25 14:25:01 localhost.localdomain systemd[1]: keepalived.service failed. Hint: Some lines were ellipsized, use -l to show in full.
Warning: ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=203/EXEC)
Check that the ll /usr/sbin/keepalived file does not exist, there are two ways to solve it at this time
1. Copy a keepalived to /usr/sbin/
2. Modify the /lib/systemd/system/keepalived.service file, and change the /usr/sbin/ path to the path where we store the keepalived file
[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. Take effect
systemctl daemon-reload
4. Restart
[root@localhost keepalived-1.3.4]# systemctl start keepalived [root@localhost keepalived-1.3.4]# 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 四 2019-04-25 14:30:01 CST; 2s ago Process: 17691 ExecStart=/usr/local/bin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS) Main PID: 17692 (keepalived) CGroup: /system.slice/keepalived.service ├─17692 /usr/local/bin/keepalived -D ├─17693 /usr/local/bin/keepalived -D └─17694 /usr/local/bin/keepalived -D 4月 25 14:30:02 localhost.localdomain Keepalived_vrrp[17694]: VRRP_Instance(VI_1) Changing effective p...52 4月 25 14:30:03 localhost.localdomain Keepalived_vrrp[17694]: VRRP_Instance(VI_1) Entering MASTER STATE 4月 25 14:30:03 localhost.localdomain Keepalived_vrrp[17694]: VRRP_Instance(VI_1) setting protocol VIPs. 4月 25 14:30:03 localhost.localdomain Keepalived_healthcheckers[17693]: Netlink reflector reports IP 17...d 4月 25 14:30:03 localhost.localdomain Keepalived_vrrp[17694]: Sending gratuitous ARP on em1 for 172.28...09 4月 25 14:30:03 localhost.localdomain Keepalived_vrrp[17694]: VRRP_Instance(VI_1) Sending/queueing gra...09 4月 25 14:30:03 localhost.localdomain Keepalived_vrrp[17694]: Sending gratuitous ARP on em1 for 172.28...09 4月 25 14:30:03 localhost.localdomain Keepalived_vrrp[17694]: Sending gratuitous ARP on em1 for 172.28...09 4月 25 14:30:03 localhost.localdomain Keepalived_vrrp[17694]: Sending gratuitous ARP on em1 for 172.28...09 4月 25 14:30:03 localhost.localdomain Keepalived_vrrp[17694]: Sending gratuitous ARP on em1 for 172.28...09 Hint: Some lines were ellipsized, use -l to show in full.
success
Read More:
- Centos7 executes the command service mysqld start and prompts Failed to start mysqld.service: Unit mysqld.service not loaded
- Failed to start Remote desktop service (VNC)
- MongoDB Error: Failed to start mongod.service: Unit mongodb.service is masked
- Tdengine failed to start, start request repeated too quickly for taosd.service
- MongoDB Error: Failed to start mongod.service: Unit mongod.service is not loaded properly
- docker service Failed to get D-Bus connection: Operation not permitted
- MySQL error set: failed to start mysql.service : Unit mysql.service is masked.
- ArcGIS publishing service analysis report error unresolved 00002 data frame has no space reference
- Nginx start error: job for nginx.service failed because the control process exited with error code
- Solve net start mysql, start MySQL service, prompt system error 5. Access denied.
- How to Fix Failed to start service jboss.deployment.unit.”jboss-as-bmt.war”.INSTALL: org.jboss.msc.service.S
- MySQL uses net start MySQL startup prompt (failed to start, the service did not report any error)
- kali Error: service metasploit start [How to Solve]
- systemctl start docker Job for docker.service failed because the control process exited with error
- Docker service start, restart, close command
- Failed to start docker.service : unit not found
- Tomcat service failed to start
- win10 unable to start ssh-agent service, error :1058 solution
- nt service 1072 No need to restart, repeat the method of installing the service program or service driver
- Apache service failed to start, semaphore not released