MySQL+keepalived高可用配置

MySQL高可用
基础环境:
基于MySQL互为主从(双主、主主)


主的操作
1.在keepalived主服务器上安装keepalived
解压依赖包

[root@test-11 soft]# ll
总用量 950892
drwxr-xr-x. 4 root root        63 9月  19 17:40 first
-rw-r--r--. 1 root root  73313464 9月  19 17:26 first.tar.gz
-rw-r--r--  1 root root   1184652 10月 26 09:42 keepalived-2.2.7.tgz
-rw-r--r--  1 root root   2413538 10月 26 09:42 keepalived-depen.tgz
drwxr-xr-x  2 root root      4096 10月 18 18:58 mysql-8.0.30-1.el7.x86_64
-rw-r--r--  1 root root 896789949 10月 26 09:43 mysql-8.0.30-1.el7.x86_64.tgz
[root@test-11 soft]# tar zxvf keepalived-depen.tgz
keepalived-depen/
keepalived-depen/keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm
keepalived-depen/krb5-devel-1.15.1-54.el7_9.x86_64.rpm
keepalived-depen/libcom_err-devel-1.42.9-19.el7.x86_64.rpm
keepalived-depen/libkadm5-1.15.1-54.el7_9.x86_64.rpm
keepalived-depen/libselinux-devel-2.5-15.el7.x86_64.rpm
keepalived-depen/libsepol-devel-2.5-10.el7.x86_64.rpm
keepalived-depen/libverto-devel-0.2.5-4.el7.x86_64.rpm
keepalived-depen/openssl-devel-1.0.2k-25.el7_9.x86_64.rpm
keepalived-depen/pcre-devel-8.32-17.el7.x86_64.rpm
keepalived-depen/zlib-devel-1.2.7-20.el7_9.x86_64.rpm
keepalived-depen/keepalived.conf
keepalived-depen/shell/
keepalived-depen/shell/CheckMySQL.sh

安装依赖包

[root@test-11 soft]# rpm -ivh keepalived-depen/*.rpm 
准备中...                          ################################# [100%]
正在升级/安装...
   1:zlib-devel-1.2.7-20.el7_9        ################################# [ 10%]
   2:pcre-devel-8.32-17.el7           ################################# [ 20%]
   3:libverto-devel-0.2.5-4.el7       ################################# [ 30%]
   4:libsepol-devel-2.5-10.el7        ################################# [ 40%]
   5:libselinux-devel-2.5-15.el7      ################################# [ 50%]
   6:libkadm5-1.15.1-54.el7_9         ################################# [ 60%]
   7:libcom_err-devel-1.42.9-19.el7   ################################# [ 70%]
   8:keyutils-libs-devel-1.5.8-3.el7  ################################# [ 80%]
   9:krb5-devel-1.15.1-54.el7_9       ################################# [ 90%]
  10:openssl-devel-1:1.0.2k-25.el7_9  ################################# [100%]

解压keepalived源码包

[root@test-11 soft]# tar zxvf keepalived-2.2.7.tgz  -C /usr/local/
keepalived-2.2.7/aclocal.m4
keepalived-2.2.7/AUTHOR
keepalived-2.2.7/autogen.sh
keepalived-2.2.7/bin_install/
keepalived-2.2.7/bin_install/Makefile.in
keepalived-2.2.7/bin_install/Makefile.am
keepalived-2.2.7/build-aux/
keepalived-2.2.7/build-aux/install-sh
keepalived-2.2.7/build-aux/missing
keepalived-2.2.7/build-aux/compile
keepalived-2.2.7/build-aux/depcomp
keepalived-2.2.7/build-aux/ar-lib
keepalived-2.2.7/build_setup
keepalived-2.2.7/ChangeLog
keepalived-2.2.7/configure
keepalived-2.2.7/configure.ac
keepalived-2.2.7/CONTRIBUTORS
keepalived-2.2.7/COPYING
keepalived-2.2.7/doc/
keepalived-2.2.7/doc/Makefile.in
keepalived-2.2.7/doc/man/
keepalived-2.2.7/doc/man/man8/
keepalived-2.2.7/doc/man/man8/Makefile.in
keepalived-2.2.7/doc/man/man8/Makefile.am
keepalived-2.2.7/doc/man/man8/keepalived.8.in
keepalived-2.2.7/doc/man/man8/keepalived.8
keepalived-2.2.7/doc/man/man1/
keepalived-2.2.7/doc/man/man1/genhash.1
keepalived-2.2.7/doc/man/man1/Makefile.in
keepalived-2.2.7/doc/man/man1/Makefile.am
keepalived-2.2.7/doc/man/man1/genhash.1.in
keepalived-2.2.7/doc/man/man5/
keepalived-2.2.7/doc/man/man5/Makefile.in
keepalived-2.2.7/doc/man/man5/keepalived.conf.5.in
keepalived-2.2.7/doc/man/man5/Makefile.am
keepalived-2.2.7/doc/man/man5/keepalived.conf.5
keepalived-2.2.7/doc/samples/
keepalived-2.2.7/doc/samples/keepalived.conf.vrrp.static_ipaddress
keepalived-2.2.7/doc/samples/keepalived.conf.vrrp.localcheck
keepalived-2.2.7/doc/samples/keepalived.conf.vrrp.routes
keepalived-2.2.7/doc/samples/keepalived.conf.sample
keepalived-2.2.7/doc/samples/keepalived.conf.track_interface
keepalived-2.2.7/doc/samples/keepalived.conf.status_code
keepalived-2.2.7/doc/samples/keepalived.conf.virtualhost
keepalived-2.2.7/doc/samples/keepalived.conf.quorum
keepalived-2.2.7/doc/samples/keepalived.conf.SMTP_CHECK
keepalived-2.2.7/doc/samples/keepalived.conf.vrrp.sync
keepalived-2.2.7/doc/samples/keepalived.conf.vrrp.rules
keepalived-2.2.7/doc/samples/keepalived.conf.vrrp
keepalived-2.2.7/doc/samples/keepalived.conf.fwmark
keepalived-2.2.7/doc/samples/keepalived.conf.vrrp.scripts
keepalived-2.2.7/doc/samples/sample.misccheck.smbcheck.sh
keepalived-2.2.7/doc/samples/keepalived.conf.SSL_GET
keepalived-2.2.7/doc/samples/keepalived.conf.HTTP_GET.port
keepalived-2.2.7/doc/samples/keepalived.conf.IPv6
keepalived-2.2.7/doc/samples/keepalived.conf.misc_check
keepalived-2.2.7/doc/samples/keepalived.conf.vrrp.lvs_syncd
keepalived-2.2.7/doc/samples/sample_notify_fifo.sh
keepalived-2.2.7/doc/samples/keepalived.conf.UDP_CHECK
keepalived-2.2.7/doc/samples/keepalived.conf.conditional_conf
keepalived-2.2.7/doc/samples/keepalived.conf.inhibit
keepalived-2.2.7/doc/samples/keepalived.conf.virtual_server_group
keepalived-2.2.7/doc/samples/keepalived.conf.PING_CHECK
keepalived-2.2.7/doc/samples/keepalived.conf.misc_check_arg
keepalived-2.2.7/doc/source/
keepalived-2.2.7/doc/source/_static/
keepalived-2.2.7/doc/source/_static/.gitignore
keepalived-2.2.7/doc/source/_static/.gitkeep
keepalived-2.2.7/doc/source/tools/
keepalived-2.2.7/doc/source/tools/pydoctheme/
keepalived-2.2.7/doc/source/tools/pydoctheme/static/
keepalived-2.2.7/doc/source/tools/pydoctheme/static/pydoctheme.css
keepalived-2.2.7/doc/source/tools/pydoctheme/theme.conf
keepalived-2.2.7/doc/source/installing_keepalived.rst
keepalived-2.2.7/doc/source/images/
keepalived-2.2.7/doc/source/images/software_design.png
keepalived-2.2.7/doc/source/scheduling_algorithms.rst
keepalived-2.2.7/doc/source/load_balancing_techniques.rst
keepalived-2.2.7/doc/source/_templates/
keepalived-2.2.7/doc/source/_templates/.gitignore
keepalived-2.2.7/doc/source/_templates/.gitkeep
keepalived-2.2.7/doc/source/case_study_failover.rst
keepalived-2.2.7/doc/source/license.rst
keepalived-2.2.7/doc/source/configuration_synopsis.rst
keepalived-2.2.7/doc/source/conf.py
keepalived-2.2.7/doc/source/snmp_support.rst
keepalived-2.2.7/doc/source/protocol_support.rst
keepalived-2.2.7/doc/source/terminology.rst
keepalived-2.2.7/doc/source/software_design.rst
keepalived-2.2.7/doc/source/about.rst
keepalived-2.2.7/doc/source/todo.rst
keepalived-2.2.7/doc/source/case_study_healthcheck.rst
keepalived-2.2.7/doc/source/introduction.rst
keepalived-2.2.7/doc/source/index.rst
keepalived-2.2.7/doc/source/programs_synopsis.rst
keepalived-2.2.7/doc/source/case_study_mixing.rst
keepalived-2.2.7/doc/VRRP-MIB.txt
keepalived-2.2.7/doc/Makefile.am
keepalived-2.2.7/doc/NOTE_vrrp_vmac.txt
keepalived-2.2.7/doc/KEEPALIVED-MIB.txt
keepalived-2.2.7/doc/keepalived.conf.SYNOPSIS
keepalived-2.2.7/doc/VRRPv3-MIB.txt
keepalived-2.2.7/Dockerfile.in
keepalived-2.2.7/INSTALL
keepalived-2.2.7/keepalived/
keepalived-2.2.7/keepalived/vrrp/
keepalived-2.2.7/keepalived/vrrp/vrrp_sync.c
keepalived-2.2.7/keepalived/vrrp/vrrp_data.c
keepalived-2.2.7/keepalived/vrrp/vrrp_firewall.c
keepalived-2.2.7/keepalived/vrrp/vrrp_nftables.c
keepalived-2.2.7/keepalived/vrrp/vrrp_if.c
keepalived-2.2.7/keepalived/vrrp/vrrp_scheduler.c
keepalived-2.2.7/keepalived/vrrp/Makefile.in
keepalived-2.2.7/keepalived/vrrp/vrrp_iptables.c
keepalived-2.2.7/keepalived/vrrp/vrrp_dbus.c
keepalived-2.2.7/keepalived/vrrp/vrrp_track.c
keepalived-2.2.7/keepalived/vrrp/vrrp_iptables_calls.c
keepalived-2.2.7/keepalived/vrrp/vrrp.c
keepalived-2.2.7/keepalived/vrrp/vrrp_json.c
keepalived-2.2.7/keepalived/vrrp/vrrp_ndisc.c
keepalived-2.2.7/keepalived/vrrp/vrrp_ipaddress.c
keepalived-2.2.7/keepalived/vrrp/vrrp_iprule.c
keepalived-2.2.7/keepalived/vrrp/vrrp_static_track.c
keepalived-2.2.7/keepalived/vrrp/Makefile.am
keepalived-2.2.7/keepalived/vrrp/vrrp_snmp.c
keepalived-2.2.7/keepalived/vrrp/vrrp_parser.c
keepalived-2.2.7/keepalived/vrrp/vrrp_print.c
keepalived-2.2.7/keepalived/vrrp/vrrp_iproute.c
keepalived-2.2.7/keepalived/vrrp/vrrp_daemon.c
keepalived-2.2.7/keepalived/vrrp/vrrp_notify.c
keepalived-2.2.7/keepalived/vrrp/vrrp_arp.c
keepalived-2.2.7/keepalived/vrrp/vrrp_if_config.c
keepalived-2.2.7/keepalived/vrrp/vrrp_ipset.c
keepalived-2.2.7/keepalived/vrrp/vrrp_ip_rule_route_parser.c
keepalived-2.2.7/keepalived/vrrp/vrrp_vmac.c
keepalived-2.2.7/keepalived/vrrp/vrrp_ipsecah.c
keepalived-2.2.7/keepalived/Makefile.in
keepalived-2.2.7/keepalived/dbus/
keepalived-2.2.7/keepalived/dbus/org.keepalived.Vrrp1.Instance.xml
keepalived-2.2.7/keepalived/dbus/Makefile.in
keepalived-2.2.7/keepalived/dbus/Makefile.am
keepalived-2.2.7/keepalived/dbus/org.keepalived.Vrrp1.Vrrp.xml_template
keepalived-2.2.7/keepalived/dbus/org.keepalived.Vrrp1.conf
keepalived-2.2.7/keepalived/bfd/
keepalived-2.2.7/keepalived/bfd/bfd_daemon.c
keepalived-2.2.7/keepalived/bfd/bfd_event.c
keepalived-2.2.7/keepalived/bfd/bfd.c
keepalived-2.2.7/keepalived/bfd/Makefile.in
keepalived-2.2.7/keepalived/bfd/Makefile.am
keepalived-2.2.7/keepalived/bfd/bfd_data.c
keepalived-2.2.7/keepalived/bfd/bfd_scheduler.c
keepalived-2.2.7/keepalived/bfd/bfd_parser.c
keepalived-2.2.7/keepalived/include/
keepalived-2.2.7/keepalived/include/global_data.h
keepalived-2.2.7/keepalived/include/global_parser.h
keepalived-2.2.7/keepalived/include/vrrp_scheduler.h
keepalived-2.2.7/keepalived/include/check_genhash.h
keepalived-2.2.7/keepalived/include/vrrp_ipset.h
keepalived-2.2.7/keepalived/include/tracker.h
keepalived-2.2.7/keepalived/include/bfd_daemon.h
keepalived-2.2.7/keepalived/include/vrrp_parser.h
keepalived-2.2.7/keepalived/include/vrrp_firewall.h
keepalived-2.2.7/keepalived/include/vrrp_data.h
keepalived-2.2.7/keepalived/include/vrrp_ipaddress.h
keepalived-2.2.7/keepalived/include/keepalived_netlink.h
keepalived-2.2.7/keepalived/include/check_api.h
keepalived-2.2.7/keepalived/include/vrrp_arp.h
keepalived-2.2.7/keepalived/include/vrrp_nftables.h
keepalived-2.2.7/keepalived/include/namespaces.h
keepalived-2.2.7/keepalived/include/nftables.h
keepalived-2.2.7/keepalived/include/bfd_data.h
keepalived-2.2.7/keepalived/include/check_smtp.h
keepalived-2.2.7/keepalived/include/bfd.h
keepalived-2.2.7/keepalived/include/check_http.h
keepalived-2.2.7/keepalived/include/vrrp_notify.h
keepalived-2.2.7/keepalived/include/check_udp.h
keepalived-2.2.7/keepalived/include/vrrp_json.h
keepalived-2.2.7/keepalived/include/config_notify.h
keepalived-2.2.7/keepalived/include/track_process.h
keepalived-2.2.7/keepalived/include/ipwrapper.h
keepalived-2.2.7/keepalived/include/vrrp_if_config.h
keepalived-2.2.7/keepalived/include/libnl_link.h
keepalived-2.2.7/keepalived/include/check_nftables.h
keepalived-2.2.7/keepalived/include/vrrp_if.h
keepalived-2.2.7/keepalived/include/snmp.h
keepalived-2.2.7/keepalived/include/check_data.h
keepalived-2.2.7/keepalived/include/bfd_parser.h
keepalived-2.2.7/keepalived/include/vrrp_iprule.h
keepalived-2.2.7/keepalived/include/check_snmp.h
keepalived-2.2.7/keepalived/include/vrrp_ip_rule_route_parser.h
keepalived-2.2.7/keepalived/include/vrrp_sock.h
keepalived-2.2.7/keepalived/include/layer4.h
keepalived-2.2.7/keepalived/include/libipvs.h
keepalived-2.2.7/keepalived/include/track_file.h
keepalived-2.2.7/keepalived/include/vrrp_iptables_calls.h
keepalived-2.2.7/keepalived/include/check_dns.h
keepalived-2.2.7/keepalived/include/check_ssl.h
keepalived-2.2.7/keepalived/include/vrrp_iptables.h
keepalived-2.2.7/keepalived/include/ip_vs.h
keepalived-2.2.7/keepalived/include/check_misc.h
keepalived-2.2.7/keepalived/include/vrrp_track.h
keepalived-2.2.7/keepalived/include/vrrp_sync.h
keepalived-2.2.7/keepalived/include/bfd_scheduler.h
keepalived-2.2.7/keepalived/include/check_bfd.h
keepalived-2.2.7/keepalived/include/daemon.h
keepalived-2.2.7/keepalived/include/check_ping.h
keepalived-2.2.7/keepalived/include/bfd_event.h
keepalived-2.2.7/keepalived/include/vrrp_iproute.h
keepalived-2.2.7/keepalived/include/vrrp_ipsecah.h
keepalived-2.2.7/keepalived/include/main.h
keepalived-2.2.7/keepalived/include/check_file.h
keepalived-2.2.7/keepalived/include/smtp.h
keepalived-2.2.7/keepalived/include/vrrp_static_track.h
keepalived-2.2.7/keepalived/include/vrrp_snmp.h
keepalived-2.2.7/keepalived/include/vrrp_daemon.h
keepalived-2.2.7/keepalived/include/vrrp_print.h
keepalived-2.2.7/keepalived/include/vrrp_vmac.h
keepalived-2.2.7/keepalived/include/check_parser.h
keepalived-2.2.7/keepalived/include/vrrp.h
keepalived-2.2.7/keepalived/include/ipvswrapper.h
keepalived-2.2.7/keepalived/include/vrrp_dbus.h
keepalived-2.2.7/keepalived/include/check_tcp.h
keepalived-2.2.7/keepalived/include/reload_monitor.h
keepalived-2.2.7/keepalived/include/check_print.h
keepalived-2.2.7/keepalived/include/pidfile.h
keepalived-2.2.7/keepalived/include/vrrp_ndisc.h
keepalived-2.2.7/keepalived/include/check_daemon.h
keepalived-2.2.7/keepalived/Makefile.am
keepalived-2.2.7/keepalived/keepalived-non-root.service.in
keepalived-2.2.7/keepalived/trackers/
keepalived-2.2.7/keepalived/trackers/Makefile.in
keepalived-2.2.7/keepalived/trackers/Makefile.am
keepalived-2.2.7/keepalived/trackers/track_file.c
keepalived-2.2.7/keepalived/keepalived.service.in
keepalived-2.2.7/keepalived/etc/
keepalived-2.2.7/keepalived/etc/init/
keepalived-2.2.7/keepalived/etc/init/keepalived.conf.in
keepalived-2.2.7/keepalived/etc/init/Makefile.in
keepalived-2.2.7/keepalived/etc/init/Makefile.am
keepalived-2.2.7/keepalived/etc/Makefile.in
keepalived-2.2.7/keepalived/etc/sysconfig/
keepalived-2.2.7/keepalived/etc/sysconfig/Makefile.in
keepalived-2.2.7/keepalived/etc/sysconfig/keepalived.in
keepalived-2.2.7/keepalived/etc/sysconfig/.gitignore
keepalived-2.2.7/keepalived/etc/sysconfig/Makefile.am
keepalived-2.2.7/keepalived/etc/sysconfig/Makefile
keepalived-2.2.7/keepalived/etc/openrc/
keepalived-2.2.7/keepalived/etc/openrc/keepalived
keepalived-2.2.7/keepalived/etc/Makefile.am
keepalived-2.2.7/keepalived/etc/keepalived/
keepalived-2.2.7/keepalived/etc/keepalived/Makefile.in
keepalived-2.2.7/keepalived/etc/keepalived/Makefile.am
keepalived-2.2.7/keepalived/etc/keepalived/keepalived.conf.sample.in
keepalived-2.2.7/keepalived/etc/init.d/
keepalived-2.2.7/keepalived/etc/init.d/Makefile.in
keepalived-2.2.7/keepalived/etc/init.d/Makefile.am
keepalived-2.2.7/keepalived/etc/init.d/keepalived
keepalived-2.2.7/keepalived/etc/init.d/keepalived.suse.init.in
keepalived-2.2.7/keepalived/main.c
keepalived-2.2.7/keepalived/core/
keepalived-2.2.7/keepalived/core/smtp.c
keepalived-2.2.7/keepalived/core/Makefile.in
keepalived-2.2.7/keepalived/core/snmp.c
keepalived-2.2.7/keepalived/core/keepalived_netlink.c
keepalived-2.2.7/keepalived/core/layer4.c
keepalived-2.2.7/keepalived/core/nftables.c
keepalived-2.2.7/keepalived/core/Makefile.am
keepalived-2.2.7/keepalived/core/global_parser.c
keepalived-2.2.7/keepalived/core/global_data.c
keepalived-2.2.7/keepalived/core/track_process.c
keepalived-2.2.7/keepalived/core/pidfile.c
keepalived-2.2.7/keepalived/core/libnl_link.c
keepalived-2.2.7/keepalived/core/main.c
keepalived-2.2.7/keepalived/core/namespaces.c
keepalived-2.2.7/keepalived/core/config_notify.c
keepalived-2.2.7/keepalived/core/daemon.c
keepalived-2.2.7/keepalived/core/reload_monitor.c
keepalived-2.2.7/keepalived/check/
keepalived-2.2.7/keepalived/check/check_daemon.c
keepalived-2.2.7/keepalived/check/check_print.c
keepalived-2.2.7/keepalived/check/check_ping.c
keepalived-2.2.7/keepalived/check/check_data.c
keepalived-2.2.7/keepalived/check/Makefile.in
keepalived-2.2.7/keepalived/check/check_bfd.c
keepalived-2.2.7/keepalived/check/check_ssl.c
keepalived-2.2.7/keepalived/check/check_misc.c
keepalived-2.2.7/keepalived/check/check_nftables.c
keepalived-2.2.7/keepalived/check/check_api.c
keepalived-2.2.7/keepalived/check/Makefile.am
keepalived-2.2.7/keepalived/check/check_udp.c
keepalived-2.2.7/keepalived/check/check_smtp.c
keepalived-2.2.7/keepalived/check/ipwrapper.c
keepalived-2.2.7/keepalived/check/check_genhash.c
keepalived-2.2.7/keepalived/check/check_parser.c
keepalived-2.2.7/keepalived/check/check_snmp.c
keepalived-2.2.7/keepalived/check/check_http.c
keepalived-2.2.7/keepalived/check/ipvswrapper.c
keepalived-2.2.7/keepalived/check/check_dns.c
keepalived-2.2.7/keepalived/check/check_file.c
keepalived-2.2.7/keepalived/check/check_tcp.c
keepalived-2.2.7/keepalived/check/libipvs.c
keepalived-2.2.7/keepalived.spec.in
keepalived-2.2.7/lib/
keepalived-2.2.7/lib/html.c
keepalived-2.2.7/lib/list_head.c
keepalived-2.2.7/lib/memory.h
keepalived-2.2.7/lib/rbtree.c
keepalived-2.2.7/lib/rbtree_types.h
keepalived-2.2.7/lib/Makefile.in
keepalived-2.2.7/lib/signals.h
keepalived-2.2.7/lib/logger.h
keepalived-2.2.7/lib/process.h
keepalived-2.2.7/lib/notify.c
keepalived-2.2.7/lib/rbtree_ka.h
keepalived-2.2.7/lib/list_head.h
keepalived-2.2.7/lib/timer.c
keepalived-2.2.7/lib/bitops.h
keepalived-2.2.7/lib/align.h
keepalived-2.2.7/lib/config_warnings.h.in
keepalived-2.2.7/lib/logger.c
keepalived-2.2.7/lib/config.h.in
keepalived-2.2.7/lib/json_writer.c
keepalived-2.2.7/lib/Makefile.am
keepalived-2.2.7/lib/json_writer.h
keepalived-2.2.7/lib/warnings.h
keepalived-2.2.7/lib/container.h
keepalived-2.2.7/lib/process.c
keepalived-2.2.7/lib/signals.c
keepalived-2.2.7/lib/html.h
keepalived-2.2.7/lib/rbtree_augmented.h
keepalived-2.2.7/lib/keepalived_magic.h
keepalived-2.2.7/lib/parser.h
keepalived-2.2.7/lib/scheduler.c
keepalived-2.2.7/lib/parser.c
keepalived-2.2.7/lib/assert.c
keepalived-2.2.7/lib/systemd.h
keepalived-2.2.7/lib/assert_debug.h
keepalived-2.2.7/lib/memory.c
keepalived-2.2.7/lib/vector.c
keepalived-2.2.7/lib/rbtree.h
keepalived-2.2.7/lib/systemd.c
keepalived-2.2.7/lib/utils.h
keepalived-2.2.7/lib/rttables.c
keepalived-2.2.7/lib/notify.h
keepalived-2.2.7/lib/vector.h
keepalived-2.2.7/lib/scheduler.h
keepalived-2.2.7/lib/sockaddr.h
keepalived-2.2.7/lib/rttables.h
keepalived-2.2.7/lib/utils.c
keepalived-2.2.7/lib/git-commit.h
keepalived-2.2.7/lib/timer.h
keepalived-2.2.7/m4/
keepalived-2.2.7/m4/pkg.m4
keepalived-2.2.7/m4/as-ac-expand.m4
keepalived-2.2.7/Makefile.am
keepalived-2.2.7/Makefile.in
keepalived-2.2.7/README.md
keepalived-2.2.7/snap/
keepalived-2.2.7/snap/snapcraft.yaml
keepalived-2.2.7/snap/hooks/
keepalived-2.2.7/snap/hooks/post-refresh
keepalived-2.2.7/snap/hooks/install
keepalived-2.2.7/TODO
keepalived-2.2.7/tools/
keepalived-2.2.7/tools/timed_reload

编译安装keepalived

[root@test-11 soft]# cd /usr/local/
[root@test-11 local]# mv keepalived-2.2.7/ keepalived
[root@test-11 local]# cd keepalived/
[root@test-11 keepalived]# ./configure --sysconf=/etc/
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking whether make sets $(MAKE)... (cached) yes
checking for ranlib... ranlib
checking for grep that handles long lines and -e... /usr/bin/grep
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for strip... strip
checking for ldd... ldd
checking for ar... ar
checking the archiver (ar) interface... ar
checking if using GCC Link Time Optimisation... no
checking msghdr.msg_controllen is size_t... yes
checking diagnostic pragmas in functions... yes
checking diagnostic push/pop pragmas... yes
checking for -Wall... no
checking for -Wextra... yes
checking for -Wunused... yes
checking for -Wstrict-prototypes... yes
checking for -Wabi... yes
checking for -Wabsolute-value... no
checking for -Waddress-of-packed-member... no
checking for -Walloca... no
checking for -Walloc-larger-than=4096... no
checking for -Walloc-zero... no
checking for -Warith-conversion... no
checking for -Warray-bounds=2... no
checking for -Wattribute-alias=2... no
checking for -Wbad-function-cast... yes
checking for -Wc11-c2x-compat... no
checking for -Wcast-align... yes
checking for -Wcast-qual... yes
checking for -Wchkp... no
checking for -Wdate-time... no
checking for -Wdisabled-optimization... yes
checking for -Wdouble-promotion... yes
checking for -Wduplicated-branches... no
checking for -Wduplicated-cond... no
checking for -Wfloat-conversion... no
checking for -Wfloat-equal... yes
checking for -Wformat-overflow... no
checking for -Wformat-security... no
checking for -Wformat-signedness... no
checking for -Wformat-truncation... no
checking for -Wframe-larger-than=5120... yes
checking for -Wimplicit-fallthrough=3... no
checking for -Winit-self... yes
checking for -Winline... yes
checking for -Winvalid-pch... yes
checking for -Wjump-misses-init... yes
checking for -Wlogical-op... yes
checking for -Wmissing-declarations... yes
checking for -Wmissing-field-initializers... yes
checking for -Wmissing-include-dirs... yes
checking for -Wmissing-prototypes... yes
checking for -Wnested-externs... yes
checking for -Wnormalized... no
checking for -Wnull-dereference... no
checking for -Wold-style-definition... yes
checking for -Woverlength-strings... yes
checking for -Wpointer-arith... yes
checking for -Wredundant-decls... yes
checking for -Wshadow... yes
checking for -Wshift-overflow=2... no
checking for -Wstack-protector... yes
checking for -Wstrict-overflow=4... yes
checking for -Wstringop-overflow=2... no
checking for -Wstringop-truncation... no
checking for -Wsuggest-attribute=cold... no
checking for -Wsuggest-attribute=const... no
checking for -Wsuggest-attribute=format... yes
checking for -Wsuggest-attribute=malloc... no
checking for -Wsuggest-attribute=noreturn... yes
checking for -Wsuggest-attribute=pure... yes
checking for -Wsync-nand... yes
checking for -Wtrampolines... yes
checking for -Wundef... yes
checking for -Wuninitialized... yes
checking for -Wunknown-pragmas... yes
checking for -Wunsafe-loop-optimizations... yes
checking for -Wunsuffixed-float-constants... yes
checking for -Wunused-const-variable=2... no
checking for -Wunused-macros... no
checking for -Wvariadic-macros... yes
checking for -Wwrite-strings... yes
checking for function __attribute__((error(msg))) support... yes
checking for PIE support... yes
checking for -Wformat -Werror=format-security support... yes
checking for -Wp,-D_FORTIFY_SOURCE=2 support... yes
checking for -fexceptions support... yes
checking for -fstack-protector-strong support... yes
checking for --param=ssp-buffer-size=4 support... yes
checking for -grecord-gcc-switches support... yes
checking for -Wl,-z,relro support... yes
checking for -Wl,-z,now support... yes
checking for -O2 support... yes
checking for unaligned memory access... yes
checking for unaligned memory access causes warnings... no
checking for clock_gettime() requires -lrt... no
checking how to run the C preprocessor... gcc -E
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/prctl.h usability... yes
checking sys/prctl.h presence... yes
checking for sys/prctl.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for unistd.h... (cached) yes
checking linux/errqueue.h needs sys/time.h... no
checking asm/types.h usability... yes
checking asm/types.h presence... yes
checking for asm/types.h... yes
checking linux/ethtool.h usability... yes
checking linux/ethtool.h presence... yes
checking for linux/ethtool.h... yes
checking linux/icmpv6.h usability... yes
checking linux/icmpv6.h presence... yes
checking for linux/icmpv6.h... yes
checking linux/if_ether.h usability... yes
checking linux/if_ether.h presence... yes
checking for linux/if_ether.h... yes
checking linux/if_packet.h usability... yes
checking linux/if_packet.h presence... yes
checking for linux/if_packet.h... yes
checking linux/ip.h usability... yes
checking linux/ip.h presence... yes
checking for linux/ip.h... yes
checking linux/sockios.h usability... yes
checking linux/sockios.h presence... yes
checking for linux/sockios.h... yes
checking linux/types.h usability... yes
checking linux/types.h presence... yes
checking for linux/types.h... yes
checking for linux/fib_rules.h... yes
checking for linux/if_addr.h... yes
checking for linux/if_link.h... yes
checking for linux/if_arp.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for inline... inline
checking for int64_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking for an ANSI C-conforming const... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for dup2... yes
checking for dup3... yes
checking for getcwd... yes
checking for gettimeofday... yes
checking for malloc... yes
checking for memmove... yes
checking for memset... yes
checking for realloc... yes
checking for select... yes
checking for setenv... yes
checking for socket... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strdup... yes
checking for strerror... yes
checking for strpbrk... yes
checking for strstr... yes
checking for strtol... yes
checking for strtoul... yes
checking for uname... yes
checking for vsyslog... yes
checking for memfd_create... no
checking whether __NR_memfd_create is declared... yes
checking whether O_TMPFILE is declared... yes
checking whether ETHERTYPE_IPV6 is declared... yes
checking whether IPV6_MULTICAST_ALL is declared... no
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... yes
checking for openssl/ssl.h... yes
checking openssl/err.h usability... yes
checking openssl/err.h presence... yes
checking for openssl/err.h... yes
checking openssl/md5.h usability... yes
checking openssl/md5.h presence... yes
checking for openssl/md5.h... yes
checking openssl/evp.h usability... yes
checking openssl/evp.h presence... yes
checking for openssl/evp.h... yes
checking for EVP_DigestInit_ex in -lcrypto... yes
checking for EVP_MD_CTX_new in -lcrypto... no
checking for SSL_CTX_new in -lssl... yes
checking SSL_set_tlsext_host_name() - may be a definition... yes
checking for SSL_CTX_set_verify_depth... yes
checking for SSL_set0_rbio... no
checking for OPENSSL_init_crypto... no
checking for TLS_method... no
checking whether IPV4_DEVCONF_ARP_IGNORE is declared... no
checking whether IPV4_DEVCONF_ACCEPT_LOCAL is declared... no
checking whether IPV4_DEVCONF_RP_FILTER is declared... no
checking whether IPV4_DEVCONF_ARPFILTER is declared... no
checking for linux/rtnetlink.h... yes
checking for nl_socket_modify_cb in -lnl... no
configure: WARNING: keepalived will be built without libnl support.
checking for magic_open in -lmagic... no
checking whether RTA_ENCAP is declared... yes
checking whether RTA_EXPIRES is declared... yes
checking whether RTA_NEWDST is declared... no
checking whether RTA_PREF is declared... yes
checking whether FRA_SUPPRESS_PREFIXLEN is declared... yes
checking whether FRA_SUPPRESS_IFGROUP is declared... no
checking whether FRA_TUN_ID is declared... yes
checking whether RTAX_CC_ALGO is declared... yes
checking whether RTAX_QUICKACK is declared... yes
checking whether RTEXT_FILTER_SKIP_STATS is declared... no
checking whether FRA_L3MDEV is declared... no
checking whether FRA_UID_RANGE is declared... no
checking whether RTAX_FASTOPEN_NO_COOKIE is declared... no
checking whether RTA_VIA is declared... yes
checking whether FRA_PROTOCOL is declared... no
checking whether FRA_IP_PROTO is declared... no
checking whether FRA_SPORT_RANGE is declared... no
checking whether FRA_DPORT_RANGE is declared... no
checking whether RTA_TTL_PROPAGATE is declared... no
checking whether IFA_FLAGS is declared... yes
checking whether LWTUNNEL_ENCAP_MPLS is declared... no
checking whether LWTUNNEL_ENCAP_ILA is declared... no
checking libiptc/libip6tc.h usability... no
checking libiptc/libip6tc.h presence... no
checking for libiptc/libip6tc.h... no
checking whether NFTA_TABLE_MAX is declared... yes
configure: WARNING: libnftnl missing
configure: WARNING: libmnl missing
checking for linux/if.h and net/if.h namespace collision... yes
checking for linux/if_ether.h then netinet/in.h then linux/if.h namespace collision... no
checking for linux/if_ether.h then netinet/if_ether.h namespace collision... no
checking for libiptc/libiptc.h linux/if.h and net/if.h namespace collision... yes
checking whether IPVS_DEST_ATTR_ADDR_FAMILY is declared... no
checking whether IPVS_DAEMON_ATTR_SYNC_MAXLEN is declared... yes
checking whether IPVS_DAEMON_ATTR_MCAST_GROUP is declared... no
checking whether IPVS_DAEMON_ATTR_MCAST_GROUP6 is declared... no
checking whether IPVS_DAEMON_ATTR_MCAST_PORT is declared... no
checking whether IPVS_DAEMON_ATTR_MCAST_TTL is declared... no
checking whether IPVS_SVC_ATTR_STATS64 is declared... no
checking whether IPVS_DEST_ATTR_STATS64 is declared... no
checking whether IPVS_DEST_ATTR_TUN_TYPE is declared... no
checking whether IP_VS_TUNNEL_ENCAP_FLAG_NOCSUM is declared... no
checking whether IP_VS_CONN_F_TUNNEL_TYPE_GRE is declared... no
checking whether IFLA_IPVLAN_MODE is declared... no
checking whether GLOB_BRACE is declared... yes
checking whether GLOB_ALTDIRFUNC is declared... yes
checking for timegm()... yes
checking whether IFLA_INET6_ADDR_GEN_MODE is declared... yes
checking whether IFLA_VRF_MAX is declared... no
checking whether SO_MARK is declared... yes
checking for sphinx-build... No
checking for rpm... Yes
checking for rpmbuild... Yes

checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating keepalived/Makefile
config.status: creating lib/Makefile
config.status: creating keepalived/core/Makefile
config.status: creating keepalived.spec
config.status: creating Dockerfile
config.status: creating keepalived/check/Makefile
config.status: creating keepalived/vrrp/Makefile
config.status: creating keepalived/bfd/Makefile
config.status: creating doc/Makefile
config.status: creating bin_install/Makefile
config.status: creating keepalived/dbus/Makefile
config.status: creating keepalived/etc/Makefile
config.status: creating keepalived/etc/init/Makefile
config.status: creating keepalived/etc/init.d/Makefile
config.status: creating keepalived/etc/sysconfig/Makefile
config.status: creating keepalived/etc/keepalived/Makefile
config.status: creating keepalived/trackers/Makefile
config.status: creating doc/man/man8/Makefile
config.status: creating doc/man/man5/Makefile
config.status: creating doc/man/man1/Makefile
config.status: creating lib/config.h
config.status: creating lib/config_warnings.h
config.status: executing depfiles commands

Keepalived configuration
------------------------
Keepalived version       : 2.2.7
Compiler                 : gcc gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Preprocessor flags       : -D_GNU_SOURCE
Compiler flags           : -g -g -O2 -Wextra -Wunused -Wstrict-prototypes -Wabi -Wbad-function-cast -Wcast-align -Wcast-qual -Wdisabled-optimization -Wdouble-promotion -Wfloat-equal -Wframe-larger-than=5120 -Winit-self -Winline -Winvalid-pch -Wjump-misses-init -Wlogical-op -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Woverlength-strings -Wpointer-arith -Wredundant-decls -Wshadow -Wstack-protector -Wstrict-overflow=4 -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsync-nand -Wtrampolines -Wundef -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunsuffixed-float-constants -Wvariadic-macros -Wwrite-strings -fPIE -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -O2
Linker flags             : -pie -Wl,-z,relro -Wl,-z,now
Extra Lib                : -lm -lcrypto -lssl
Use IPVS Framework       : Yes
IPVS use libnl           : No
IPVS syncd attributes    : No
IPVS 64 bit stats        : No
HTTP_GET regex support   : No
fwmark socket support    : Yes
Use VRRP Framework       : Yes
Use VRRP VMAC            : Yes
Use VRRP authentication  : Yes
With track_process       : Yes
With linkbeat            : Yes
Use BFD Framework        : No
SNMP vrrp support        : No
SNMP checker support     : No
SNMP RFCv2 support       : No
SNMP RFCv3 support       : No
DBUS support             : No
Use JSON output          : No
libnl version            : None
Use IPv4 devconf         : No
Use iptables             : No
Use nftables             : No
init type                : systemd
systemd notify           : No
Strict config checks     : No
Build documentation      : No
Default runtime options  : -D

*** WARNING - this build will not support IPVS with IPv6. Please install libnl/libnl-3 dev libraries to support IPv6 with IPVS.

[root@test-11 keepalived]#
[root@test-11 keepalived]# make && make install
Making all in lib
make[1]: 进入目录“/usr/local/keepalived/lib”
make  all-am
make[2]: 进入目录“/usr/local/keepalived/lib”
  CC       memory.o
  CC       utils.o
utils.c: 在函数‘inet_ntop2’中:
utils.c:428:36: 警告:从不兼容的指针类型初始化 [默认启用]
  const unsigned char (*bytep)[4] = (unsigned char (*)[4])&ip;
                                    ^
utils.c: 在函数‘dump_buffer’中:
utils.c:106:5: 警告:无法优化可能无穷的循环 [-Wunsafe-loop-optimizations]
     for (j = i - 15; j <= i; j++)
     ^
  CC       notify.o
  CC       timer.o
  CC       scheduler.o
  CC       vector.o
  CC       html.o
  CC       parser.o
  CC       signals.o
  CC       logger.o
  CC       list_head.o
  CC       rbtree.o
  CC       process.o
  CC       json_writer.o
  CC       rttables.o
rttables.c:57:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_LOCAL, "local", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:58:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_NAT, "nat", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:59:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_BROADCAST, "broadcast", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:60:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_BROADCAST, "brd", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:61:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_ANYCAST, "anycast", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:62:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_MULTICAST, "multicast", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:63:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_PROHIBIT, "prohibit", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:64:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_UNREACHABLE, "unreachable", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:65:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_BLACKHOLE, "blackhole", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:66:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_XRESOLVE, "xresolve", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:67:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_UNICAST, "unicast", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:68:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTN_THROW, "throw", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:69:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { 0, NULL, {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:73:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_UNSPEC, "none", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:74:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_REDIRECT, "redirect", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:75:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_KERNEL, "kernel", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:76:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_BOOT, "boot", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:77:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_STATIC, "static", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:79:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_GATED, "gated", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:80:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_RA, "ra", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:81:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_MRT, "mrt", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:82:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_ZEBRA, "zebra", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:83:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_BIRD, "bird", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:87:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_DNROUTED, "dnrouted", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:88:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_XORP, "xorp", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:89:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_NTK, "ntk", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:90:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RTPROT_DHCP, "dhcp", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:91:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { 0, NULL, {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:95:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RT_TABLE_DEFAULT, "default", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:96:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RT_TABLE_MAIN, "main", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:97:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RT_TABLE_LOCAL, "local", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:98:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { 0, NULL, {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:102:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RT_SCOPE_UNIVERSE, "global", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:103:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RT_SCOPE_NOWHERE, "nowhere", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:104:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RT_SCOPE_HOST, "host", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:105:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RT_SCOPE_LINK, "link", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:106:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { RT_SCOPE_SITE, "site", {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
rttables.c:107:2: 警告:missing initializer for field ‘next’ of ‘list_head_t’ [-Wmissing-field-initializers]
  { 0, NULL, {}},
  ^
In file included from rttables.c:31:0:
list_head.h:49:20: 附注:‘next’在此声明
  struct list_head *next, *prev;
                    ^
  AR       liblib.a
make[2]: 离开目录“/usr/local/keepalived/lib”
make[1]: 离开目录“/usr/local/keepalived/lib”
Making all in keepalived
make[1]: 进入目录“/usr/local/keepalived/keepalived”
Making all in core
make[2]: 进入目录“/usr/local/keepalived/keepalived/core”
  CC       main.o
main.c: 在函数‘sigend’中:
main.c:1212:34: 警告:assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow]
   for (i = 0; i < NUM_CHILD_TERM && wait_count; i++) {
                                  ^
main.c:1234:6: 警告:assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow]
   if (wait_count) {
      ^
main.c:1171:8: 警告:assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow]
  while (wait_count) {
        ^
  CC       daemon.o
  CC       pidfile.o
  CC       layer4.o
  CC       smtp.o
  CC       global_data.o
  CC       global_parser.o
  CC       keepalived_netlink.o
  CC       namespaces.o
  CC       track_process.o
  CC       reload_monitor.o
  CC       config_notify.o
  AR       libcore.a
make[2]: 离开目录“/usr/local/keepalived/keepalived/core”
Making all in vrrp
make[2]: 进入目录“/usr/local/keepalived/keepalived/vrrp”
  CC       vrrp_daemon.o
  CC       vrrp_print.o
  CC       vrrp_data.o
  CC       vrrp_parser.o
  CC       vrrp.o
  CC       vrrp_notify.o
  CC       vrrp_scheduler.o
vrrp_scheduler.c: 在函数‘try_up_instance’中:
vrrp_scheduler.c:675:2: 警告:missing initializer for field ‘ifa’ of ‘ip_address_t’ [-Wmissing-field-initializers]
  ip_address_t ip_addr = {};
  ^
In file included from ../../keepalived/include/vrrp_arp.h:34:0,
                 from vrrp_scheduler.c:43:
../../keepalived/include/vrrp_ipaddress.h:44:19: 附注:‘ifa’在此声明
  struct ifaddrmsg ifa;
                   ^
  CC       vrrp_sync.o
  CC       vrrp_arp.o
  CC       vrrp_if.o
vrrp_if.c: 在函数‘set_default_garp_delay’中:
vrrp_if.c:475:2: 警告:missing initializer for field ‘garp_interval’ of ‘garp_delay_t’ [-Wmissing-field-initializers]
  garp_delay_t default_delay = {};
  ^
In file included from ../../keepalived/include/global_data.h:47:0,
                 from vrrp_if.c:51:
../../keepalived/include/vrrp_if.h:75:13: 附注:‘garp_interval’在此声明
  timeval_t  garp_interval;  /* Delay between sending gratuitous ARP messages on an interface */
             ^
  CC       vrrp_track.o
  CC       vrrp_ipaddress.o
vrrp_ipaddress.c: 在函数‘clear_diff_static_addresses’中:
vrrp_ipaddress.c:814:2: 警告:missing initializer for field ‘family’ of ‘vrrp_t’ [-Wmissing-field-initializers]
  vrrp_t old = {};
  ^
In file included from ../../keepalived/include/vrrp_ipaddress.h:35:0,
                 from vrrp_ipaddress.c:31:
../../keepalived/include/vrrp.h:247:15: 附注:‘family’在此声明
  sa_family_t  family;   /* AF_INET|AF_INET6 */
               ^
vrrp_ipaddress.c:815:2: 警告:missing initializer for field ‘family’ of ‘vrrp_t’ [-Wmissing-field-initializers]
  vrrp_t new = {};
  ^
In file included from ../../keepalived/include/vrrp_ipaddress.h:35:0,
                 from vrrp_ipaddress.c:31:
../../keepalived/include/vrrp.h:247:15: 附注:‘family’在此声明
  sa_family_t  family;   /* AF_INET|AF_INET6 */
               ^
  CC       vrrp_ndisc.o
  CC       vrrp_if_config.o
  CC       vrrp_static_track.o
  CC       vrrp_iproute.o
  CC       vrrp_iprule.o
  CC       vrrp_ip_rule_route_parser.o
  CC       vrrp_vmac.o
  CC       vrrp_ipsecah.o
  AR       libvrrp.a
make[2]: 离开目录“/usr/local/keepalived/keepalived/vrrp”
Making all in check
make[2]: 进入目录“/usr/local/keepalived/keepalived/check”
  CC       check_daemon.o
  CC       check_data.o
  CC       check_parser.o
  CC       check_api.o
  CC       check_tcp.o
  CC       check_http.o
  CC       check_ssl.o
  CC       check_genhash.o
check_genhash.c: 在函数‘genhash_usage’中:
check_genhash.c:83:3: 警告:字符串长‘881’比‘509’(ISO C90 被要求支持的最大长度) 还要长 [-Woverlength-strings]
   "   --timeout         -t       Timeout in seconds\n");
   ^
  CC       check_smtp.o
  CC       check_misc.o
  CC       check_dns.o
  CC       check_print.o
  CC       ipwrapper.o
  CC       ipvswrapper.o
  CC       libipvs.o
  CC       check_udp.o
  CC       check_ping.o
  CC       check_file.o
  AR       libcheck.a
make[2]: 离开目录“/usr/local/keepalived/keepalived/check”
Making all in trackers
make[2]: 进入目录“/usr/local/keepalived/keepalived/trackers”
  CC       track_file.o
  AR       libtracker.a
make[2]: 离开目录“/usr/local/keepalived/keepalived/trackers”
Making all in etc
make[2]: 进入目录“/usr/local/keepalived/keepalived/etc”
Making all in init
make[3]: 进入目录“/usr/local/keepalived/keepalived/etc/init”
make[3]: 对“all”无需做任何事。
make[3]: 离开目录“/usr/local/keepalived/keepalived/etc/init”
Making all in init.d
make[3]: 进入目录“/usr/local/keepalived/keepalived/etc/init.d”
make[3]: 对“all”无需做任何事。
make[3]: 离开目录“/usr/local/keepalived/keepalived/etc/init.d”
Making all in keepalived
make[3]: 进入目录“/usr/local/keepalived/keepalived/etc/keepalived”
  CP       keepalived.conf.sample
make[3]: 离开目录“/usr/local/keepalived/keepalived/etc/keepalived”
Making all in sysconfig
make[3]: 进入目录“/usr/local/keepalived/keepalived/etc/sysconfig”
  EDIT     keepalived
make[3]: 离开目录“/usr/local/keepalived/keepalived/etc/sysconfig”
make[3]: 进入目录“/usr/local/keepalived/keepalived/etc”
make[3]: 对“all-am”无需做任何事。
make[3]: 离开目录“/usr/local/keepalived/keepalived/etc”
make[2]: 离开目录“/usr/local/keepalived/keepalived/etc”
make[2]: 进入目录“/usr/local/keepalived/keepalived”
  CC       main.o
  CCLD     keepalived
  EDIT     keepalived-non-root.service
  EDIT     keepalived.service
make[2]: 离开目录“/usr/local/keepalived/keepalived”
make[1]: 离开目录“/usr/local/keepalived/keepalived”
Making all in doc
make[1]: 进入目录“/usr/local/keepalived/doc”
Making all in man/man8
make[2]: 进入目录“/usr/local/keepalived/doc/man/man8”
  EDIT     keepalived.8
make[2]: 离开目录“/usr/local/keepalived/doc/man/man8”
Making all in man/man5
make[2]: 进入目录“/usr/local/keepalived/doc/man/man5”
  EDIT     keepalived.conf.5
make[2]: 离开目录“/usr/local/keepalived/doc/man/man5”
Making all in man/man1
make[2]: 进入目录“/usr/local/keepalived/doc/man/man1”
  EDIT     genhash.1
make[2]: 离开目录“/usr/local/keepalived/doc/man/man1”
make[2]: 进入目录“/usr/local/keepalived/doc”
make[2]: 对“all-am”无需做任何事。
make[2]: 离开目录“/usr/local/keepalived/doc”
make[1]: 离开目录“/usr/local/keepalived/doc”
Making all in bin_install
make[1]: 进入目录“/usr/local/keepalived/bin_install”
make[1]: 离开目录“/usr/local/keepalived/bin_install”
make[1]: 进入目录“/usr/local/keepalived”
  EDIT     README
make[1]: 离开目录“/usr/local/keepalived”
Making install in lib
make[1]: 进入目录“/usr/local/keepalived/lib”
make  install-am
make[2]: 进入目录“/usr/local/keepalived/lib”
make[3]: 进入目录“/usr/local/keepalived/lib”
make[3]: 对“install-exec-am”无需做任何事。
make[3]: 对“install-data-am”无需做任何事。
make[3]: 离开目录“/usr/local/keepalived/lib”
make[2]: 离开目录“/usr/local/keepalived/lib”
make[1]: 离开目录“/usr/local/keepalived/lib”
Making install in keepalived
make[1]: 进入目录“/usr/local/keepalived/keepalived”
Making install in core
make[2]: 进入目录“/usr/local/keepalived/keepalived/core”
make[3]: 进入目录“/usr/local/keepalived/keepalived/core”
make[3]: 对“install-exec-am”无需做任何事。
make[3]: 对“install-data-am”无需做任何事。
make[3]: 离开目录“/usr/local/keepalived/keepalived/core”
make[2]: 离开目录“/usr/local/keepalived/keepalived/core”
Making install in vrrp
make[2]: 进入目录“/usr/local/keepalived/keepalived/vrrp”
make[3]: 进入目录“/usr/local/keepalived/keepalived/vrrp”
make[3]: 对“install-exec-am”无需做任何事。
make[3]: 对“install-data-am”无需做任何事。
make[3]: 离开目录“/usr/local/keepalived/keepalived/vrrp”
make[2]: 离开目录“/usr/local/keepalived/keepalived/vrrp”
Making install in check
make[2]: 进入目录“/usr/local/keepalived/keepalived/check”
make[3]: 进入目录“/usr/local/keepalived/keepalived/check”
make[3]: 对“install-exec-am”无需做任何事。
make[3]: 对“install-data-am”无需做任何事。
make[3]: 离开目录“/usr/local/keepalived/keepalived/check”
make[2]: 离开目录“/usr/local/keepalived/keepalived/check”
Making install in trackers
make[2]: 进入目录“/usr/local/keepalived/keepalived/trackers”
make[3]: 进入目录“/usr/local/keepalived/keepalived/trackers”
make[3]: 对“install-exec-am”无需做任何事。
make[3]: 对“install-data-am”无需做任何事。
make[3]: 离开目录“/usr/local/keepalived/keepalived/trackers”
make[2]: 离开目录“/usr/local/keepalived/keepalived/trackers”
Making install in etc
make[2]: 进入目录“/usr/local/keepalived/keepalived/etc”
Making install in init
make[3]: 进入目录“/usr/local/keepalived/keepalived/etc/init”
make[4]: 进入目录“/usr/local/keepalived/keepalived/etc/init”
make[4]: 对“install-exec-am”无需做任何事。
make[4]: 离开目录“/usr/local/keepalived/keepalived/etc/init”
make[3]: 离开目录“/usr/local/keepalived/keepalived/etc/init”
Making install in init.d
make[3]: 进入目录“/usr/local/keepalived/keepalived/etc/init.d”
make[4]: 进入目录“/usr/local/keepalived/keepalived/etc/init.d”
make[4]: 对“install-exec-am”无需做任何事。
make[4]: 离开目录“/usr/local/keepalived/keepalived/etc/init.d”
make[3]: 离开目录“/usr/local/keepalived/keepalived/etc/init.d”
Making install in keepalived
make[3]: 进入目录“/usr/local/keepalived/keepalived/etc/keepalived”
make[4]: 进入目录“/usr/local/keepalived/keepalived/etc/keepalived”
make[4]: 对“install-exec-am”无需做任何事。
 /usr/bin/mkdir -p '/etc/keepalived'
 /usr/bin/install -c -m 644 keepalived.conf.sample '/etc/keepalived'
make  install-data-hook
make[5]: 进入目录“/usr/local/keepalived/keepalived/etc/keepalived”
make[5]: 离开目录“/usr/local/keepalived/keepalived/etc/keepalived”
make[4]: 离开目录“/usr/local/keepalived/keepalived/etc/keepalived”
make[3]: 离开目录“/usr/local/keepalived/keepalived/etc/keepalived”
Making install in sysconfig
make[3]: 进入目录“/usr/local/keepalived/keepalived/etc/sysconfig”
make[4]: 进入目录“/usr/local/keepalived/keepalived/etc/sysconfig”
make[4]: 对“install-exec-am”无需做任何事。
 /usr/bin/mkdir -p '/etc/sysconfig'
 /usr/bin/install -c -m 644 keepalived '/etc/sysconfig'
make[4]: 离开目录“/usr/local/keepalived/keepalived/etc/sysconfig”
make[3]: 离开目录“/usr/local/keepalived/keepalived/etc/sysconfig”
make[3]: 进入目录“/usr/local/keepalived/keepalived/etc”
make[4]: 进入目录“/usr/local/keepalived/keepalived/etc”
make[4]: 对“install-exec-am”无需做任何事。
make[4]: 对“install-data-am”无需做任何事。
make[4]: 离开目录“/usr/local/keepalived/keepalived/etc”
make[3]: 离开目录“/usr/local/keepalived/keepalived/etc”
make[2]: 离开目录“/usr/local/keepalived/keepalived/etc”
make[2]: 进入目录“/usr/local/keepalived/keepalived”
make[3]: 进入目录“/usr/local/keepalived/keepalived”
 /usr/bin/mkdir -p '/usr/local/sbin'
  /usr/bin/install -c keepalived '/usr/local/sbin'
make  install-exec-hook
make[4]: 进入目录“/usr/local/keepalived/keepalived”
/usr/bin/mkdir -p //usr/local/bin
make[4]: 离开目录“/usr/local/keepalived/keepalived”
 /usr/bin/mkdir -p '/usr/lib/systemd/system'
 /usr/bin/install -c -m 644 keepalived.service '/usr/lib/systemd/system'
make[3]: 离开目录“/usr/local/keepalived/keepalived”
make[2]: 离开目录“/usr/local/keepalived/keepalived”
make[1]: 离开目录“/usr/local/keepalived/keepalived”
Making install in doc
make[1]: 进入目录“/usr/local/keepalived/doc”
Making install in man/man8
make[2]: 进入目录“/usr/local/keepalived/doc/man/man8”
make[3]: 进入目录“/usr/local/keepalived/doc/man/man8”
make[3]: 对“install-exec-am”无需做任何事。
 /usr/bin/mkdir -p '/usr/local/share/man/man8'
 /usr/bin/install -c -m 644 keepalived.8 '/usr/local/share/man/man8'
make[3]: 离开目录“/usr/local/keepalived/doc/man/man8”
make[2]: 离开目录“/usr/local/keepalived/doc/man/man8”
Making install in man/man5
make[2]: 进入目录“/usr/local/keepalived/doc/man/man5”
make[3]: 进入目录“/usr/local/keepalived/doc/man/man5”
make[3]: 对“install-exec-am”无需做任何事。
 /usr/bin/mkdir -p '/usr/local/share/man/man5'
 /usr/bin/install -c -m 644 keepalived.conf.5 '/usr/local/share/man/man5'
make[3]: 离开目录“/usr/local/keepalived/doc/man/man5”
make[2]: 离开目录“/usr/local/keepalived/doc/man/man5”
Making install in man/man1
make[2]: 进入目录“/usr/local/keepalived/doc/man/man1”
make[3]: 进入目录“/usr/local/keepalived/doc/man/man1”
make[3]: 对“install-exec-am”无需做任何事。
 /usr/bin/mkdir -p '/usr/local/share/man/man1'
 /usr/bin/install -c -m 644 genhash.1 '/usr/local/share/man/man1'
make[3]: 离开目录“/usr/local/keepalived/doc/man/man1”
make[2]: 离开目录“/usr/local/keepalived/doc/man/man1”
make[2]: 进入目录“/usr/local/keepalived/doc”
make[3]: 进入目录“/usr/local/keepalived/doc”
make[3]: 对“install-exec-am”无需做任何事。
 /usr/bin/mkdir -p '/usr/local/share/snmp/mibs'
 /usr/bin/mkdir -p '/etc/keepalived/samples'
 /usr/bin/install -c -m 644 ./samples/keepalived.conf.conditional_conf ./samples/keepalived.conf.fwmark ./samples/keepalived.conf.HTTP_GET.port ./samples/keepalived.conf.inhibit ./samples/keepalived.conf.IPv6 ./samples/keepalived.conf.misc_check ./samples/keepalived.conf.misc_check_arg ./samples/keepalived.conf.PING_CHECK ./samples/keepalived.conf.quorum ./samples/keepalived.conf.sample ./samples/keepalived.conf.SMTP_CHECK ./samples/keepalived.conf.SSL_GET ./samples/keepalived.conf.status_code ./samples/keepalived.conf.track_interface ./samples/keepalived.conf.UDP_CHECK ./samples/keepalived.conf.virtualhost ./samples/keepalived.conf.virtual_server_group ./samples/keepalived.conf.vrrp ./samples/keepalived.conf.vrrp.localcheck ./samples/keepalived.conf.vrrp.lvs_syncd ./samples/keepalived.conf.vrrp.routes ./samples/keepalived.conf.vrrp.rules ./samples/keepalived.conf.vrrp.scripts ./samples/keepalived.conf.vrrp.static_ipaddress ./samples/keepalived.conf.vrrp.sync ./samples/sample.misccheck.smbcheck.sh ./samples/sample_notify_fifo.sh '/etc/keepalived/samples'
make[3]: 离开目录“/usr/local/keepalived/doc”
make[2]: 离开目录“/usr/local/keepalived/doc”
make[1]: 离开目录“/usr/local/keepalived/doc”
Making install in bin_install
make[1]: 进入目录“/usr/local/keepalived/bin_install”
make[2]: 进入目录“/usr/local/keepalived/bin_install”
make[2]: 对“install-exec-am”无需做任何事。
make[2]: 对“install-data-am”无需做任何事。
make[2]: 离开目录“/usr/local/keepalived/bin_install”
make[1]: 离开目录“/usr/local/keepalived/bin_install”
make[1]: 进入目录“/usr/local/keepalived”
make[2]: 进入目录“/usr/local/keepalived”
make[2]: 对“install-exec-am”无需做任何事。
 /usr/bin/mkdir -p '/usr/local/share/doc/keepalived'
 /usr/bin/install -c -m 644 README '/usr/local/share/doc/keepalived'
make  install-data-hook
make[3]: 进入目录“/usr/local/keepalived”
make[3]: 对“install-data-hook”无需做任何事。
make[3]: 离开目录“/usr/local/keepalived”
make[2]: 离开目录“/usr/local/keepalived”
make[1]: 离开目录“/usr/local/keepalived”
[root@test-11 keepalived]#

 

2.编辑配置文件
vim /etc/keepalived/keepalived.conf

内容如下:

! Configuration File for keepalived

global_defs {
    notification_email {
        acassen@firewall.loc
        failover@firewall.loc
        sysadmin@firewall.loc
    }
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 192.168.200.1
    smtp_connect_timeout 30
    router_id LVS_DEVEL
    vrrp_skip_check_adv_addr
    #vrrp_strict
    vrrp_garp_interval 0
    vrrp_gna_interval 0
}

vrrp_script Check_MySQL {
    script "/home/shell/CheckMySQL.sh"
    interval 5
    weight -5
    fall 2
    rise 1
}

vrrp_instance VI_1 {
        state MASTER
        interface ens34
        virtual_router_id 51
        priority 100
        advert_int 1
        authentication {
                auth_type PASS
                auth_pass 1111

        }

        virtual_ipaddress {
                192.168.2.10
        }
        track_script {
                Check_MySQL
        }
}

3. 生成停止mysql的脚本

[root@test-11 keepalived]# mkdir /home/shell
[root@test-11 keepalived]# vim /home/shell/CheckMySQL.sh
#!/bin/sh
#This script is used for Keepalived to detect MySQL service
Service_Name="mysqld"
Curl_Date="`date +%F_%H`"
Log_Name="CheckMySQL"
Log_Path="/app/log/$Log_Name"
Print_Time="`date +%F` `date +%T`:$((`date +%N`/1000000))"
if [ $(whoami) == "root" ]; then    #判断当前登录用户是否为root用户
    pgrep -x ${Service_Name} >> /dev/null    #使用当前登录用户检测MySQL
    if [ $? -eq 0 ];then    #判断检测结果
        if [ ! -d "${Log_Path}" ];then    #判断日志路径是否存在:不存在就创建,存在就输出内容
            mkdir -p $Log_Path
            echo -e "\n ${Print_Time} [SERVICE] <INFO> MySQL SERVICE Is Running... "  >> ${Log_Path}/${Log_Name}-${Curl_Date}.log
        else
            echo -e "\n ${Print_Time} [SERVICE] <INFO> MySQL SERVICE Is Running... "  >> ${Log_Path}/${Log_Name}-${Curl_Date}.log
        fi
    else
        if [ ! -d "${Log_Path}" ];then    #判断日志路径是否存在:不存在就创建,存在就输出内容
            mkdir -p $Log_Path
            echo -e "\n ${Print_Time} [SERVICE] <ERROR> MySQL SERVICE Has Stopped... "  >> ${Log_Path}/${Log_Name}-${Curl_Date}.log
        else
            echo -e "\n ${Print_Time} [SERVICE] <ERROR> MySQL SERVICE Has Stopped... "  >> ${Log_Path}/${Log_Name}-${Curl_Date}.log
        fi
        systemctl stop keepalived    #MySQL服务停止后自动停掉keepalived
    fi
else
    su - $(whoami) -s /bin/sh -c "pgrep -x ${Service_Name} >> /dev/null"    #不是root用户就切换到当前用户执行
    if [ $? -eq 0 ];then    ##判断检测结果
        if [ ! -d "${Log_Path}" ];then    #判断日志路径是否存在:不存在就创建,存在就输出内容
            sudo mkdir -p $Log_Path
            sudo echo -e "\n ${Print_Time} [SERVICE] <INFO> MySQL SERVICE Is Running... "  >> ${Log_Path}/${Log_Name}-${Curl_Date}.log
        else
            sudo echo -e "\n ${Print_Time} [SERVICE] <INFO> MySQL SERVICE Is Running... "  >> ${Log_Path}/${Log_Name}-${Curl_Date}.log
        fi
    else
        if [ ! -d "${Log_Path}" ];then    #判断日志路径是否存在:不存在就创建,存在就输出内容
            sudo mkdir -p $Log_Path
            sudo echo -e "\n ${Print_Time} [SERVICE] <ERROR> MySQL SERVICE Has Stopped... "  >> ${Log_Path}/${Log_Name}-${Curl_Date}.log
        else
            sudo echo -e "\n ${Print_Time} [SERVICE] <ERROR> MySQL SERVICE Has Stopped... "  >> ${Log_Path}/${Log_Name}-${Curl_Date}.log
        fi
        sudo systemctl stop keepalived    #MySQL服务停止后自动停掉keepalived
    fi
fi
exit

4.更改完毕后启动keepalived

[root@test-11 keepalived]# systemctl enable keepalived && service keepalived start
Created symlink from /etc/systemd/system/multi-user.target.wants/keepalived.service to /usr/lib/systemd/system/keepalived.service.
Redirecting to /bin/systemctl start keepalived.service
[root@test-11 keepalived]#

查看虚拟ip

[root@test-11 keepalived]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:63:5b:b6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.21.230/24 brd 192.168.21.255 scope global noprefixroute dynamic ens33
       valid_lft 77037sec preferred_lft 77037sec
    inet6 fe80::aa5c:e199:2065:a923/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:63:5b:c0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.11/24 brd 192.168.2.255 scope global noprefixroute ens34
       valid_lft forever preferred_lft forever
    inet 192.168.2.10/32 scope global ens34
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe63:5bc0/64 scope link
       valid_lft forever preferred_lft forever

 

测试

虚拟ip网络是否通

[root@test-11 keepalived]# ping 192.168.2.10
PING 192.168.2.10 (192.168.2.10) 56(84) bytes of data.
64 bytes from 192.168.2.10: icmp_seq=1 ttl=64 time=0.061 ms
64 bytes from 192.168.2.10: icmp_seq=2 ttl=64 time=0.021 ms
64 bytes from 192.168.2.10: icmp_seq=3 ttl=64 time=0.020 ms
64 bytes from 192.168.2.10: icmp_seq=4 ttl=64 time=0.021 ms

--- 192.168.2.10 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 0.020/0.030/0.061/0.018 ms
[root@test-11 keepalived]# ssh root@192.168.2.10
The authenticity of host '192.168.2.10 (192.168.2.10)' can't be established.
ECDSA key fingerprint is SHA256:B8E40BFL8NCnL4qv0xl8LipOWg3HeL7U6T3vm+nhlg4.
ECDSA key fingerprint is MD5:e3:ef:00:7e:8a:8e:56:12:e9:56:31:06:0f:9b:85:20.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.10' (ECDSA) to the list of known hosts.
root@192.168.2.10's password:
Last login: Wed Oct 26 09:40:46 2022 from 192.168.2.1
[root@test-11 ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.21.230  netmask 255.255.255.0  broadcast 192.168.21.255
        inet6 fe80::aa5c:e199:2065:a923  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:63:5b:b6  txqueuelen 1000  (Ethernet)
        RX packets 12017  bytes 3848742 (3.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 336  bytes 27476 (26.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens34: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.11  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::20c:29ff:fe63:5bc0  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:63:5b:c0  txqueuelen 1000  (Ethernet)
        RX packets 693836  bytes 940889452 (897.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 695434  bytes 1813664140 (1.6 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 101  bytes 11966 (11.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 101  bytes 11966 (11.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

停止主的mysql查看 VIP是否漂移到备份主机上,如成功漂移则是配置成功

[root@test-11 ~]# service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service

[root@test-11 ~]#
[root@test-12 keepalived]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:0a:fc:1c brd ff:ff:ff:ff:ff:ff
3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:0a:fc:26 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.12/24 brd 192.168.2.255 scope global noprefixroute ens34
       valid_lft forever preferred_lft forever
    inet 192.168.2.10/32 scope global ens34
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe0a:fc26/64 scope link
       valid_lft forever preferred_lft forever
[root@test-12 keepalived]#

 

posted @ 2020-11-09 10:40  叶宇梵  阅读(289)  评论(0)    收藏  举报