ocelot + consul 配置

{
  "ReRoutes": [
    {
      "UpstreamPathTemplate": "/api/lev2/test",//对外发布的路径
      "UpstreamHttpMethod": [ "Get" ],

      "DownstreamPathTemplate": "/test",//下游真实api路径
      "DownstreamScheme": "http",
      //"DownstreamHostAndPorts": [
      //  {
      //    "host": "localhost",//下游服务器ip端口
      //    "port": 5002
      //  }
      //],
      "ServiceName": "ApiLev2",//下游服务在consul注册的名称
      "LoadBalancerOptions": {
        "Type": "LeastConnection"
      },
      "UseServiceDiscovery": true
    }
  ],
  "GlobalConfiguration": {
    //"BaseUrl": "https://localhost:5222",//本服务地址
    "ServiceDiscoveryProvider": {
      "Host": "localhost",//consul的ip端口
      "Port": 8500,
      "Type": "PollConsul",
      "PollingInterval": 100,
      "ConfigurationKey": "Oceolot_A" //从consul同步配置
    }
  }
}

 

posted @ 2020-03-13 17:29  czcz1024  阅读(208)  评论(0编辑  收藏  举报