其他分享
首页 > 其他分享> > 2021-05-23

2021-05-23

作者:互联网

[root@centos01 ~]# vim /etc/yum.repos.d/local.repo
[root@centos01 ~]# rm -rf /etc/yum.repos.d/CentOS-*
[root@centos01 ~]# mount /dev/cdrom /mnt/
[root@centos01 ~]# yum -y install httpd在这里插入图片描述
[root@centos01 ~]#echo “www.benet.com” > /var/www/html/index.html
[root@centos01 ~]#systemctl start httpd
[root@centos01 ~]#systemctl enable httpd
[root@centos01 ~]#echo “www.accp.com” > /var/www/html/index.html
[root@centos01 ~]#systemctl start httpd
[root@centos01 ~]#systemctl enable httpd
安装lvs和keepalived:
[root@centos04 ~]# vim /etc/yum.repos.d/local.repo
[root@centos04 ~]# rm -rf /etc/yum.repos.d/CentOS-*
[root@centos04 ~]# mount /dev/cdrom /mnt/
[root@centos04 ~]# yum -y install ipvsadm keepalived
设置服务开机自动启动:
[root@centos04 ~]# systemctl enable ipvsadm
[root@centos04 ~]# systemctl enable keepalived
[root@centos05 ~]# vim /etc/yum.repos.d/local.repo
[root@centos05 ~]# rm -rf /etc/yum.repos.d/CentOS-*
[root@centos05 ~]# mount /dev/cdrom /mnt/
[root@centos05 ~]# yum -y install keepalived ipvsadm
[root@centos05 ~]#systemctl enable keepalived
[root@centos05 ~]systemctl enable keepalived
[root@centos05 ~]systemctl enable ipvsadm
修改keepalived主配置文件 :
[root@centos04 ~]# vim /etc/keepalived/keepalived.conf
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
修改LVS服务器内核参数禁止相应客户端请求:
[root@centos04 ~]# vim /etc/sysctl.conf
[root@centos04 ~]#sysctl -p
修改网站内核参数运行相应客户端请求 :
[root@centos01 ~]# vim /etc/sysctl.conf
[root@centos04 ~]#sysctl -p
启动服务:
[root@centos04 ~]# systemctl start keepalived
在这里插入图片描述
[root@centos04 ~]#systemctl stop keepalived
在这里插入图片描述
在这里插入图片描述
[root@centos03 ~]# rm -rf /etc/yum.repos.d/CentOS-*
[root@centos03 ~]# mount /dev/cdrom /mnt/
[root@centos03 ~]# yum -y install rpcbind nfs-utils
[root@centos03 ~]# mkdir /web
[root@centos03 ~]# echo “www.nfs.com” > /web/inex.html
[root@centos03 ~]# vim /etc/exports
[root@centos03 ~]#systemctl restart rpcbind
[root@centos03 ~]#systemctl restart nfs
[root@centos03 ~]#systemctl enable nfs
[root@centos03 ~]#systemctl enable rpcbind
[root@centos03 ~]#systemctl enable rpcbind
[root@centos03 ~]#showmount -e 192.168.100.30在这里插入图片描述

标签:centos03,05,keepalived,centos01,23,centos04,systemctl,2021,root
来源: https://blog.csdn.net/qq_51106163/article/details/117198655