当前位置 主页 > 服务器问题 > win服务器问题汇总 >

    windows第七层负载均衡

    栏目:win服务器问题汇总 时间:2018-11-30 09:13

    下面小编就为大家分享一篇windows第七层负载均衡_基于IIS的ARR负载均衡详解,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧

    载均衡有很多种方法,有硬件负载均衡,软件负载均衡,还可以从域名解析下手。

    不过,今天只讲软件负载均衡。

    软件负载均衡一般分两种,从网络协议来讲(tcp/ip),主要集中在第四层和第七层进行负载均衡。

    第四层就是基于IP进行负载均衡。后面还有一篇文章讲这个。

    第七层就是应用层。比如各种的WEB服务器。今天就讲讲IIS的负载均衡。

    第七层的Web负载均衡,很多web服务器都支持,比如IIS,Nginx,apache等。现在主要讲一下windosw下IIS如何使用负载均衡

    IIS使用ARR反向代理,实现负载均衡

    什么是正向代理?

    代理服务器大家可能听说过,比如我们说的“科学上网”。就是使用代理服务器,请求经过代理服务器转到目的服务器。这是一个正向代理。用户知道自己使用代理,并且充许用户隐藏客户端自身。

    什么是反向代理?

    请求同样经过代理服务器转到目的服务器,目的服务器返回给代理服器,代理返回给客户端。不同的时候,客户并不知道,访问的是一个代理服务器。客户认为他在访问目的服务器。

    两者的区别基本在于,正向代理是发生在客户端。反向代理是发生在服务端。

    首先,我们先安装一个Web平台安装程序

    打开web平台安装程序,搜索arr

    写WebApi程序

    [Route("api/[controller]")]public class HomeController : Controller{ // GET: api/<controller> [HttpGet,Route("GetUserChat")] public async Task<ActionResult> GetUserChat() { var collection = new MongoHelper().GetCollection<OAChat>("OAChat"); var chatItems =await collection.Find(n => n.ChatType == 2).Limit(5).ToListAsync(); return ApiJsonFormat.GetJsonResult(chatItems); }}

    返回结果

    {"ResultCode":1000,"Message":"成功","DetailError":null,"Data":[{"Id":"595225a5bbccc61ff88e89a7","ChatName":"testttt","ChatType":2,"CreaterUserId":76,"Members":[],"CreateTime":"2017-06-27 17:30:13","LastChatTime":"2017-11-10 17:43:17","LastChatText":"[定位]","IsDisbanded":false},{"Id":"5952445ebbccc71ff8adf671","ChatName":"测试2","ChatType":2,"CreaterUserId":13,"Members":[],"CreateTime":"2017-06-27 19:41:18","LastChatTime":"2017-06-27 19:48:47","LastChatText":"行","IsDisbanded":true},{"Id":"5952463dbbccc71ff8adf67d","ChatName":"巡视频么么哒哒","ChatType":2,"CreaterUserId":13,"Members":[],"CreateTime":"2017-06-27 19:49:17","LastChatTime":"2017-12-20 19:47:17","LastChatText":"[定位]","IsDisbanded":false},{"Id":"59524c0ebbccc71ff8adf6ae","ChatName":"rrrffff","ChatType":2,"CreaterUserId":13,"Members":[],"CreateTime":"2017-06-27 20:14:06","LastChatTime":"2017-06-27 20:34:54","LastChatText":"6565","IsDisbanded":false},{"Id":"59531cdfbbccc414e8f6769f","ChatName":"都纷纷fee俄方热热","ChatType":2,"CreaterUserId":76,"Members":[],"CreateTime":"2017-06-28 11:05:03","LastChatTime":"2017-06-28 11:05:13","LastChatText":"123","IsDisbanded":true},{"Id":"59531de5bbccc414e8f676a1","ChatName":"天赋过人托管人","ChatType":2,"CreaterUserId":76,"Members":[],"CreateTime":"2017-06-28 11:09:25","LastChatTime":"2017-06-28 11:09:33","LastChatText":"呃呃呃","IsDisbanded":true},{"Id":"59531e40bbccc414e8f676a3","ChatName":"热热","ChatType":2,"CreaterUserId":76,"Members":[],"CreateTime":"2017-06-28 11:10:56","LastChatTime":"2017-06-28 17:58:41","LastChatText":"333","IsDisbanded":false},{"Id":"59532140bbccc414e8f676a6","ChatName":"会厌结核有机会好好","ChatType":2,"CreaterUserId":76,"Members":[],"CreateTime":"2017-06-28 11:23:44","LastChatTime":"2017-06-28 11:24:40","LastChatText":"eee","IsDisbanded":true},{"Id":"595321d3bbccc414e8f676a8","ChatName":"656565656","ChatType":2,"CreaterUserId":76,"Members":[],"CreateTime":"2017-06-28 11:26:11","LastChatTime":"2017-06-28 18:50:08","LastChatText":"ggg","IsDisbanded":false},{"Id":"5954d0eebbccc40fecbea435","ChatName":"r","ChatType":2,"CreaterUserId":76,"Members":[],"CreateTime":"2017-06-29 18:05:34","LastChatTime":null,"LastChatText":null,"IsDisbanded":false}]}