阿里云SLB配置

一、简介

负载均衡(Server Load Balancer)是对多台云服务器进行流量分发的负载均衡服务。负载均衡可以通过流量分发扩展应用系统对外的服务能力,通过消除单点故障提升应用系统的可用性。

二、配置SLB

1.购买SLB并接入交换机
公网SLB是可以直接分发到内网服务器的,这样可以不占用公网带宽。
这里使用内网SLB示例,因为免费。

2.配置后端服务器
(1)环境介绍

ip环境
172.17.198.246SLB的分发ip
172.17.198.242单机LNMP
172.17.198.238单机LNMP

(2)配置

ip权重文件
172.17.198.2421index.php
172.17.198.2383inex.html

3.配置端口
前端端口80,分发到后端服务器的80端口。

4.写入访问文件并且配置nginx

[root@172.17.198.238 test]# cat index.html
test 2018

[root@172.17.198.242 test]# cat index.php 
<?php
phpinfo();
?>

三、访问

1.使用curl -H “Host:zwwl.test.com”指定域名测试,负载均衡配置成功。

[root@zhangwan22222222 ~]# curl 172.17.198.246:80 -H "Host:zwwl.test.com"
test 2018
[root@zhangwan22222222 ~]# curl 172.17.198.246:80 -H "Host:zwwl.test.com"
test 2018
[root@zhangwan22222222 ~]# curl 172.17.198.246:80 -H "Host:zwwl.test.com"
test 2018
[root@zhangwan22222222 ~]# curl 172.17.198.246:80 -H "Host:zwwl.test.com"|less
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>;
<style type="text/css">
body {background-color: #fff; color: #222; font-family: sans-serif;}
pre {margin: 0; font-family: monospace;}
a:link {color: #009; text-decoration: none; background-color: #fff;}
a:hover {text-decoration: underline;}
table {border-collapse: collapse; border: 0; width: 934px; box-shadow: 1px 2px 3px #ccc;}
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值