Keepalived 环境部署
一、源码部署
安装编译环境、依赖包
[root@node01 ~]# yum install kernel-devel openssl-devel -y
[root@node01 ~]# yum install gcc gcc-c++ make -y
安装 Keepalived
[root@node01 ~]# ll keepalived-2.0.12.tar.gz
-rw-r--r-- 1 root root 947015 Aug 8 2020 keepalived-2.0.12.tar.gz
[root@node01 ~]# tar xf keepalived-2.0.12.tar.gz -C /usr/local/src/
[root@node01 ~]# cd /usr/local/src/keepalived-2.0.12/
[root@node01 keepalived-2.0.12]# mkdir /usr/local/keepalived
[root@node01 keepalived-2.0.12]# ./configure --prefix=/usr/local/keepalived
[root@node01 keepalived-2.0.12]# make
[root@node01 keepalived-2.0.12]# make install
二、在线 yum 部署
1、配置cheese仓库
yum install http://www.nosuchhost.net/~cheese/fedora/packages/epel-7/x86_64/cheese-release-7-1.noarch.rpm
2、安装keepalived
yum install keepalived
安装目录
[root@node01 ~]# tree /usr/local/keepalived/
/usr/local/keepalived/
├── bin
│?? └── genhash
├── etc
│?? ├── keepalived
│?? │?? ├── keepalived.conf
│?? │?? └── samples
│?? │?? ├── client.pem
│?? │?? ├── dh1024.pem
│?? │?? ├── keepalived.conf.conditional_conf
│?? │?? ├── keepalived.conf.fwmark
│?? │?? ├── keepalived.conf.HTTP_GET.port
│?? │?? ├── keepalived.conf.inhibit
│?? │?? ├── keepalived.conf.IPv6
│?? │?? ├── keepalived.conf.misc_check
│?? │?? ├── keepalived.conf.misc_check_arg
│?? │?? ├── keepalived.conf.quorum
│?? │?? ├── keepalived.conf.sample
│?? │?? ├── keepalived.conf.SMTP_CHECK
│?? │?? ├── keepalived.conf.SSL_GET
│?? │?? ├── keepalived.conf.status_code
│?? │?? ├── keepalived.conf.track_interface
│?? │?? ├── keepalived.conf.virtualhost
│?? │?? ├── keepalived.conf.virtual_server_group
│?? │?? ├── keepalived.conf.vrrp
│?? │?? ├── keepalived.conf.vrrp.localcheck
│?? │?? ├── keepalived.conf.vrrp.lvs_syncd
│?? │?? ├── keepalived.conf.vrrp.routes
│?? │?? ├── keepalived.conf.vrrp.rules
│?? │?? ├── keepalived.conf.vrrp.scripts
│?? │?? ├── keepalived.conf.vrrp.static_ipaddress
│?? │?? ├── keepalived.conf.vrrp.sync
│?? │?? ├── root.pem
│?? │?? ├── sample.misccheck.smbcheck.sh
│?? │?? └── sample_notify_fifo.sh
│?? └── sysconfig
│?? └── keepalived
├── sbin
│?? └── keepalived
└── share
├── doc
│?? └── keepalived
│?? └── README
├── man
│?? ├── man1
│?? │?? └── genhash.1
│?? ├── man5
│?? │?? └── keepalived.conf.5
│?? └── man8
│?? └── keepalived.8
└── snmp
└── mibs
15 directories, 36 files
修改配置文件
[root@node01 ~]# ll /usr/lib/systemd/system/keepalived.service
-rw-r--r-- 1 root root 407 Mar 4 19:57 /usr/lib/systemd/system/keepalived.service
[root@node01 ~]# mkdir /etc/keepalived/
[root@node01 ~]# cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
[root@node01 ~]# systemctl start keepalived.service
[root@node01 ~]# systemctl is-active keepalived.service
active
[root@node01 ~]# ps -ef | grep keepalived
root 30577 1 0 21:14 ? 00:00:00 /usr/local/keepalived/sbin/keepalived -D
root 30578 30577 0 21:14 ? 00:00:00 /usr/local/keepalived/sbin/keepalived -D
root 30678 1292 0 21:17 pts/0 00:00:00 grep --color=auto keepalived
部署成功!!!