LVS负载均衡群集
L(Linux)v(Virtual“虚拟化”)s(Server“服务”)
结构
概述
负载均衡的结构
Linux Vitual Server
LVS的负载调度算法
环境:
开启四台centos
Centso04添加vmnet2
配置LVS负载均衡
1、安装LVS负载均衡
挂载光盘
[root@centos01 ~]# mount /dev/sr0 /mnt/
删除系统源
[root@centos01 ~]# rm -rf /etc/yum.repos.d/CentOS-*
安装http服务器
[root@centos01 ~]# yum -y install httpd
创建网站主页
[root@centos01 ~]# echo "www.benet.com" > /var/www/html/index.html
启动http服务-设置开机自动启动
[root@centos01 ~]# systemctl start httpd
[root@centos01 ~]# systemctl enable httpd
centos02
删除系统源
[root@centos02 ~]# rm -rf /etc/yum.repos.d/CentOS-*
挂载光盘
[root@centos02 ~]# mount /dev/sr0 /mnt/
安装http
[root@centos02 ~]# yum -y install httpd
创建网站主页
[root@centos02 ~]# echo "www.accp.com" > /var/www/html/index.html
启动httpd服务-设置开机自动启动
[root@centos02 ~]# systemctl start httpd
[root@centos02 ~]# systemctl enable httpd
Centos04
复制网卡配置文件
[root@centos04 ~]# cp /etc/sysconfig/network-scripts/ifcfg-ens32 /etc/sysconfig/network-scripts/ifcfg-ens34
编辑ens34网卡
[root@centos04 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens34
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
NAME=ens34
DEVICE=ens34
ONBOOT=yes
IPADDR=192.168.200.10
NETMASK=255.255.255.0
重启网卡服务
[root@centos04 ~]# systemctl restart network
开启路由功能