Cluster Application Overview
Meaning cluster
- Cluster, clusters, cluster
- It consists of multiple hosts, but only outside the performance as a whole
Cluster Category
According to the target cluster for which differences can be divided into three types
- Load-balancing clusters
- High Availability Cluster
- High Performance Computing Cluster
Load-balancing clusters (Load Balance Cluster)
- The ability to increase the impact of the application of the system, as far as possible to handle more access requests, reduce latency as the goal, to achieve high concurrency, high-load (LB) overall performance
- LB load distribution dependent on the primary node split algorithm
High availability cluster (High Availability Cluster)
- To improve the reliability of the application system, the terminal reduces the time target as possible, to ensure continuity of service, to achieve high availability (HA) fault tolerance effect
- HA works includes a duplexer and two ways from the main
High-performance computing clusters (High Performance Computer Cluster)
- To improve the application system CPU speed, scalable hardware resources and analytical capacities, to obtain the equivalent of a large, high-performance supercomputer computing (HPC) capabilities
- High performance is dependent on the high-performance computing cluster "distributed computing", "parallel operation", by dedicated hardware and software integrated CPU, memory, and other resources of the plurality of servers, realized only large, supercomputers only have the computing power
Load balancing cluster mode of analysis
Load balancing cluster is the most used business cluster model
of the cluster load scheduling technique has three operating modes
- Address Translation
- IP tunnel
- Direct Routing (DR Mode)
NAT mode - NAT (Network Address Translation)
- Referred to as the NAT mode, similar to the structure of the private network firewall, load balancer as a gateway to all of the server node, that is, as a client to access the entrance, as well as access nodes in response to export client
- Private IP address of the server node, and a load balancer located in the same physical network, security is better than the other two methods
About virtual server LVS
Linux Virtual Server
For load balancing scheme of the Linux kernel
LVS load scheduling algorithm
Polling (Round Robin)
- The access request received in turn in the order assigned to each node in the cluster (real server), uniformly treat each server, regardless of the actual number of connections and the server system load
WRR (Weighted Round Robin)
- The processing capacity of real servers in turn allocate access requests received, the query scheduler may automatically load each node and dynamically adjusts its weight
- Ensure strong server processing power to take on more traffic
LVS load scheduling algorithm
Least Connection (Least Connections)
- Allocated according to the number of connections the real server is established, access will receive priority in the allocation requests to the node with the fewest number of connections
Weighted least connections (Weighted Least Connections)
- In the big difference in performance server node, the weights may be re-adjusted automatically real server
Higher weights node will assume a greater proportion of the activities connected load
Experimental Environment Description:
1. the LVS server, WEB server dispatch two
2.WEB server 1 installed apache service
3.WEB server 2, the service installation apache
4. The server provides a storage space to achieve NFS shared storage function
5. Support machine as a test LVS polling query features
Roles | IP |
1.LVS | ens33: 192.168.100.1 ens36: 12.0.0.1 |
2.WEB1 | 192.168.100.10 |
3.WEB2 | 192.168.100.20 |
4.NFS | 192.168.100.100 |
A. Configure the NFS Service
- Check whether to install rpcbind and nfs-utils package
rpm -q nfs-utils
rpm -q rpcbind
没有安装则用
yum install nfs-utils rpcbind -y
- Create a mount directory
mkdir /opt/kgc
mkdir /opt/accp
- Configuring NFS shared storage space
vim /etc/exports
/opt/kgc 192.168.100.0/24(rw,sync,no_root_squash)
/opt/accp 192.168.100.0/24(rw,sync,no_root_squash)
- NFS feature is turned on, turn off the firewall
systemctl start nfs
systemctl start rpcbind
systemctl stop firewalld.service
//查看共享空间
showmount -e
Export list for nfs:
/opt/accp 192.168.100.0/24
/opt/kgc 192.168.100.0/24
II. Configuring two Apache Service
- kgcWEB service configuration
yum install httpd -y
//修改kgcWEB服务监听地址
vim /etc/httpd/conf/httpd.conf
Listen:192.168.100.10:80
//创建首页内容
vim /var/www/html/index.html
<h1>this is kgc web</h1>
//挂载NFS共享存储空间
kgcWEB
vim /etc/exports
192.168.100.100:/opt/kgc /var/www/html nfs defaults,_netdev 0 0
mount -a
- accpWEB service configuration
yum install httpd -y
//修改accpWEB服务监听地址
vim /etc/httpd/conf/httpd.conf
Listen:192.168.100.20:80
//创建首页内容
vim /var/www/html/index.html
<h1>this is accp web</h1>
//挂载NFS共享存储空间
accpWEB
vim /etc/exports
192.168.100.100:/opt/accp /var/www/html nfs defaults,_netdev 0 0
mount -a
Shut down two servers firewall
III. Configuring the LVS Service
- Installation services ipvsadm
yum install ipvsadm -y
- As a gateway, routing forwarding need to open
//开启路由转发功能
vim /etc/sysctl.conf
net.ipv4.ip_forward=1
systemctl -p
- Add iptables rules to set the address mapping
iptables -F
iptables -t nat -F
iptables -t nat -A POSTROUTING -o ens36 -s 192.168.100.0/24 -j SNAT --to-source 12.0.0.1
- LVS load the kernel module
modprobe ip_vs
- Open ipvsadm
ipvsadm --save > /etc/sysconfig/ipvsadm
- Open LVS Service
systemctl start ipvsadm.service
- LVS rule script writing
vim /opt/nat.sh
#!/bin/bash
ipvsadm -C //初始化
ipvsadm -A -t 12.0.0.1:80 -s rr
ipvsadm -a -t 12.0.0.1:80 -r 192.168.100.10 -m //调度服务器
ipvsadm -a -t 12.0.0.1:80 -r 192.168.100.20 -m //调度服务器
ipvsadm
- Add permissions, execute script
chmod +x /opt/nat.sh
cd /opt
./nat.sh
IV. Verification experiment
在win10浏览器上,访问 12.0.0.1,因为做了NAT模式和存储共享,所以是可以直接访问到两台Apache服务器上的网页的,这就说明群集起作用了。