构建LVS-DR负载均衡群集

安装lvs
安装ipvsadm
[root@centos04 ~]# yum -y install ipvsadm
设置服务开机自动启动
[root@centos04 ~]# systemctl enable ipvsadm
查看规则
在这里插入图片描述
保存
[root@centos04 ~]# ipvsadm-save
配置LVS的NAT模式
[root@centos04 ~]# ipvsadm -A -t
保存规则
[root@centos04 ~]# ipvsadm-save
在这里插入图片描述
查看规则
构建LVS-DR负载均衡群集_第1张图片
验证
构建LVS-DR负载均衡群集_第2张图片
构建LVS-DR负载均衡群集_第3张图片
安装共享储存服务
构建LVS-DR负载均衡群集_第4张图片
创建储存根目录
[root@centos03~]# mkdir /web
[root@centos03 ~]# echo “www.nfs.com” > /web/index.html
启动服务
[root@centos03 ~]# systemctl start nfs
[root@centos03 ~]# systemctl start rpcbind
[root@centos03 ~]# systemctl enable nfs
[root@centos03 ~]# systemctl enable rpcbind
网站链接共享
构建LVS-DR负载均衡群集_第5张图片
配置LVS的NAT模式
[root@centos04 ~]#vim /etc/sysctl.conf
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.ens32.send_redirects = 0
修改网站参数运行
[root@centos01 ~]# vim /etc/sysctl.conf
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.conf.defauil.arp_announce = 2
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
构建LVS-DR负载均衡群集_第6张图片
指定LVS负载均衡ip地址和端口
[root@centos04 ~]# ipvsadm -A -t
[root@centos04 ~]# ipvsadm -a -t
查看
构建LVS-DR负载均衡群集_第7张图片
保存
在这里插入图片描述
验证
构建LVS-DR负载均衡群集_第8张图片

你可能感兴趣的:(linux)