首页 > 课堂 > 基础知识 > 正文

LVS负载平衡群集

2024-09-12 20:30:13
字体:
来源:转载
供稿:网友
  LVS负载均衡群集
  环境准备:
 
  CentOS 7-1:调度器,网关(需要两块网卡)外:12.0.0.1 内:192.168.200.1
 
  CentOS 7-2:网站服务器(Apache)192.168.200.110
 
  CentOS 7-3:网站服务器(Apache)192.168.200.120
 
  CentOS 7-4:提供共享存储 192.168.200.130
 
  win7-1:客户端 12.0.0.12
 
  yum在线安装前置操作:
  1.共享存储服务器CentOS 7-4的操作:
 
  [root@localhost ~]# rpm -q nfs-utils
  nfs-utils-1.3.0-0.48.el7.x86_64
  [root@localhost ~]# rpm -q rpcbind
  rpcbind-0.2.0-42.el7.x86_64
  2.节点服务器CentOS 7-2和7-3两台节点服务器:
 
  [root@localhost ~]# yum install httpd -y
  3.调度器网关CentOS 7-1操作:
 
  //要先添加一个网络适配器,成为两个网卡
  [root@localhost ~]# yum install ipvsadm -y
  共享存储服务器CentOS 7-4:
  //先将网卡更改为仅主机模式
  [root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
  BOOTPROTO="static"      //将dhcp改为static
  DEVICE="ens33"
  ONBOOT="yes"
  IPADDR=192.168.200.130      //在末行下插入:IP,子网,网关
  NETMASK=255.255.255.0
  GATEWAY=192.168.200.1
  修改完成后输入:wq保存退出
  [root@localhost ~]# service network restart
  Restarting network (via systemctl):                        [  确定  ]
  [root@localhost ~]# systemctl stop firewalld.service
  [root@localhost ~]# setenforce 0
  [root@localhost ~]# systemctl start nfs.service
  [root@localhost ~]# systemctl status nfs.service
  ● nfs-server.service - NFS server and services
     Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
     Active: active (exited) since 二 2019-11-26 17:42:05 CST; 11s ago
  ......省略多行,状态为Active说明正常
  [root@localhost ~]# systemctl start rpcbind.service
  [root@localhost ~]# systemctl status rpcbind.service
  ● rpcbind.service - RPC bind service
     Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; vendor preset: enabled)
     Active: active (running) since 二 2019-11-26 17:40:23 CST; 4min 26s ago
  
  此时回到存储服务器CentOS 7-4上看是否有此文件:
 
  [root@localhost ~]# cd /opt/
  [root@localhost opt]# ls
  accp  benet  rh
  [root@localhost opt]# cd accp/
  [root@localhost accp]# ls
  index.html
  [root@localhost accp]# cat index.html
  this is accp web
  //此时有我们新建的index.html文件

(编辑:武林网)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表