环境
- 操作系统:CentOS 7
- Keepalived版本:1.4.2
准备
下载Keepalived安装包 - 方式一,将下载好的安装包上传至服务器,点击下载:keepalived-1.4.2.tar.gz - 方式二,通过wget命令直接在服务器下载
wget https://itze.cn/uploads/keepalived-1.4.2.tar.gz
|
安装
解压到/usr/local/src(位置自己可以改变)
tar -zxvf keepalived-1.4.2.tar.gz -C /usr/local/src
|
安装依赖插件
yum install -y gcc openssl-devel popt-devel
|
进入解压后的目录,进行配置,进行编译
cd /usr/local/src/keepalived-1.4.2
|
./configure --prefix=/usr/local/keepalived
|
进行编译,完成后进行安装
运行前配置
cp /usr/local/src/keepalived-1.4.2/keepalived/etc/init.d/keepalived /etc/init.d/
|
cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
|
cp /usr/local/src/keepalived-1.4.2/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
|
cp /usr/local/keepalived/sbin/keepalived /usr/sbin/
|
配置文件的修改这里不介绍,根据自己业务需要修改,会在本站文章:基于HA机制的Mycat高可用中有介绍 启动验证
systemctl start keepalived
|
查看状态
systemctl status keepalived
|