# LVS 配置
# 安装 ipvsadm
dnf install -y ipvsadm
# ipvsadm 命令
# 查看ipvsadm命令
ipvsadm -h
# 常用命令
# 管理集群服务
ipvsadm -A|E -t|u|f service-address [-s scheduler] [-p [timeout]] [-M netmask]
[--pe persistence_engine] [-b sched-flags]
ipvsadm -D -t|u|f service-address #删除
ipvsadm –C #清空
ipvsadm –R #重载,相当于 ipvsadm-restore
ipvsadm -S [-n] #保存,相当于 ipvsadm-save #管理集群中的 RS
ipvsadm -a|e -t|u|f service-address -r server-address [-g|i|m] [-w weight]
ipvsadm -d -t|u|f service-address -r server-address
ipvsadm -L|l [options]
ipvsadm -Z [-t|u|f service-address]
# 配置 ipvsadm
# 配置ipvsadm
ipvsadm -A -t 100.127.255.2:80 -s rr
ipvsadm -a -t 100.127.255.2:80 -r 100.127.255.124:80 -g
ipvsadm -a -t 100.127.255.2:80 -r 100.127.255.125:80 -g
# 查看 ipvsadm 配置
# 查看ipvsadm配置
ipvsadm -L -n
# 清空 ipvsadm 配置
# 清空ipvsadm配置
ipvsadm -C
# 保存 ipvsadm 配置
# 保存ipvsadm配置
ipvsadm -S -n > /etc/sysconfig/ipvsadm
# 重载 ipvsadm 配置
# 重载ipvsadm配置
ipvsadm -R < /etc/sysconfig/ipvsadm
# 配置 ipvsadm 开机启动
# 配置ipvsadm开机启动
systemctl enable ipvsadm
# 配置 ipvsadm 开机不启动
# 配置ipvsadm开机不启动
systemctl disable ipvsadm