centos01网站配置,挂载光盘
[root@centos01 ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
2)安装httpd
[root@centos01 ~]# yum -y install httpd
3)编辑网站主页
[root@centos01 ~]# echo “www.benet.com” > /var/www/html/index.html
4)开启服务设置开机自启
[root@centos01 ~]# systemctl start httpd
[root@centos01 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
centos02网站配置,挂载光盘
[root@centos02 ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
8)安装httpd
[root@centos02 ~]# yum -y install httpd
9)编辑网站主页
[root@centos02 ~]# echo “www.accp.com” > /var/www/html/index.html
10)开启服务设置开机自启
[root@centos02 ~]# systemctl start httpd
[root@centos02 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
安装LVS群集
1)挂载光盘
[root@centos04 ~]# mount /dev/cdrom /mnt/
'mount: /dev/sr0 写保护,将以只读方式挂载
2)安装LVS
[root@centos04 ~]# yum -y install ipvsadm
3)设置服务开机自启
[root@centos04 ~]# systemctl enable ipvsadm
Created symlink from /etc/systemd/system/multi-user.target.wants/ipvsadm.service to /usr/lib/systemd/system/ipvsadm.service.
4)查看LVS规则
[root@centos04 ~]# ipvsadm -ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
5)清空规则并保存
[root@centos04 ~]# ipvsadm -C
[root@centos04 ~]# ipvsadm-save
3、配置NAT模式的LVS
1)配置调度服务器ip地址为192.168.200.10:80端口算法使用轮询
[root@centos04 ~]# ipvsadm -A -t 192.168.200.10:80 -s rr
2)调度服务器添加物理服务器100.10和20的80端口映射到vip地址192.168.200.10的80
[root@centos04 ~]# ipvsadm -a -t 192.168.200.10:80 -r 192.168.100.10:80 -m -w 1
[root@centos04 ~]# ipvsadm -a -t 192.168.200.10:80 -r 192.168.100.20:80 -m -w 1
3)保存配置
[root@centos04 ~]# ipvsadm-save
-A -t centos04:http -s rr
-a -t centos04:http -r 192.168.100.10:http -m -w 1
-a -t centos04:http -r 192.168.100.20:http -m -w 1
centos1查看日志
centos2查看日志
安装nfs系统
[root@centos03 ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@centos03 ~]# yum -y install rpcbind nfs-utils
2)创建共享网站根目录文件
[root@centos03 ~]# mkdir /web
[root@centos03 ~]# echo “www.nfs.com” > /web/index.html
3)修改nfs主配置文件共享/web目录,允许100.10和20读取共享目录数据rw读取和写入
[root@centos03 ~]# vim /etc/exports
/web 192.168.100.10(ro) 192.168.100.20(ro)
4)启动nfs服务
[root@centos03 ~]# systemctl start rpcbind
[root@centos03 ~]# systemctl start nfs
[root@centos03 ~]# systemctl enable nfs
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
[root@centos03 ~]# systemctl enable rpcbind
5)查看共享目录
6)挂载共享目录到网站服务器根
[root@centos02 ~]# mount 192.168.100.30:/web /var/www/html/
[root@centos02 ~]# cat /var/www/html/index.html
www.nfs.com
7)外部客户端访问