一、基于nginx负载均衡调度
1.基于uri请求调度至不同集群
- web01 提供/user,使用多端口方式来模拟多个web节点
[root@web01 ~]
server {
listen 8080;
server_name agent.oldxu.com;
root /agent/8080;
location / {
index index.html;
}
}
server {
listen 8081;
server_name agent.oldxu.com;
root /agent/8081;
location / {
index index.html;
}
}
mkdir /agent/{
8080,8081} -p
echo "user-8080" > /agent/8080/index.html
echo "user-8081" > /agent/8081/index.html
systemctl reload nginx
- web02 提供/pass,使用多端口方式来模拟多个web节点
[root@web02 ~]
server {
listen 8082;
server_name agent.oldxu.com;
root /agent/8082;
location / {
index index.html;
}
}
server {
listen 8083;
server_name agent.oldxu.com;
root /agent/8083;
location / {
index index.html;
}
}
mkdir /agent/{
8082,8083} -p
echo "pass-80802" > /agent/8082/index.html
echo "pass-80803" > <