springcloud-ribbon的使用
Posted fuckingpangzi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springcloud-ribbon的使用相关的知识,希望对你有一定的参考价值。
在ribbon的springboot project import dependency jar
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-ribbon</artifactId>
<version>1.4.0.RELEASE</version>
</dependency>
best select version is 1.4.0
let is look resources configuration file application.yml
#with two client happy
server:
port: 9000
spring:
application:
name: ribbon-consumer
stores:
ribbon:
listOfServers: localhost:1001,localhost:1002
NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule
the stores is on you dynamic define,and then are fixed。the listOfServers is fixed,the value is the ip and port you repersent。
以上是关于springcloud-ribbon的使用的主要内容,如果未能解决你的问题,请参考以下文章
(19)java Spring Cloud+Spring boot+mybatis企业快速开发架构之SpringCloud-Ribbon负载均衡策略介绍