SpringCloud学习04--服务消费Ribbon和Feign

SpringCloud学习04--服务消费Ribbon和Feign

Ribbon
Ribbon 是一个基于HTTP和TCP客户端的负载均衡器,Feign中也使用了Ribbon,后面会介绍Feign的使用。

它可以在客户端配置ribbonServerList(服务端列表),然后轮询请求以实现均衡负载。

它在联合Eureka使用时ribbonServerList会被DiscoveryEnabledNIWSServerList重写,扩展成从Eureka注册中心获取服务端列表同时它也会用NIWSDiscoveryPing来取代IPing,它将职责委托给Eureka来确定服务端是否已经启动。

Feign
Spring Cloud Netflix的微服务都是以HTTP接口的形式暴露的,所以可以用Apache的HttpClient或Spring的RestTemplate去调用。

而Feign是一个声明式的Web Service客户端,它使得编写Web Serivce客户端变得更加简单。我们只需要使用Feign来创建一个接口并用注解来配置它既可完成。它具备可插拔的注解支持,包括Feign注解和JAX-RS注解。Feign也支持可插拔的编码器和解码器。Spring Cloud为Feign增加了对Spring MVC注解的支持,还整合了Ribbon和Eureka来提供均衡负载的HTTP客户端实现。

是一个使用起来更加方便的Http客户端,它用起来就像调用本地方法一样,完全感觉不到是调用的远程方法。

总结起来就是:发布到注册中心的服务方接口,是Http的,也可以不用Ribbon或Feign,直接在浏览器一样能够访问。

只不过Ribbon或Feign调用起来要方便一些,最重要的是它俩都支持软负载均衡。

注意:spring-cloud-starter-feign里面已经包含了spring-cloud-starter-ribbon
(Feign中也使用了Ribbon)

示例代码


示例代码如下(也可以直接从
Github下载:
https://github.com/v5java/demo-cloud-05-ribbon-feign

它是由五個模块组成的Maven工程,其中包含一个注册中心、兩个服务提供者、兩个服务消费者(分别由Ribbon和Feign实现)

首先启动服务注册中心


Paste_Image.png

部分日志如下:

. ____ _ __ _ _

/\ / _' __ _ () __ __ _ \ \ \ \

( ( )___ | '_ | '| | ' / _` | \ \ \ \

\/ _)| |)| | | | | || (| | ) ) ) )

' |____| .|| ||| |__, | / / / /

=========||==============|/=///_/

:: Spring Boot :: (v1.5.3.RELEASE)

[20170526094201944][main][SpringApplication.logStartupProfileInfo]No active profile set, falling back to default profiles: default

[20170526094204189][main][ConfigurationClassPostProcessor.enhanceConfigurationClasses]Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.

[20170526094207978][localhost-startStop-1][WebApplicationImpl._initiate]Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'

[20170526094208101][localhost-startStop-1][DiscoveryJerseyProvider.<init>]Using JSON encoding codec LegacyJacksonJson

[20170526094208102][localhost-startStop-1][DiscoveryJerseyProvider.<init>]Using JSON decoding codec LegacyJacksonJson

[20170526094208319][localhost-startStop-1][DiscoveryJerseyProvider.<init>]Using XML encoding codec XStreamXml

[20170526094208319][localhost-startStop-1][DiscoveryJerseyProvider.<init>]Using XML decoding codec XStreamXml

[20170526094212974][main][ArchaiusAutoConfiguration.configureArchaius]No spring.application.name found, defaulting to 'application'

[20170526094212983][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.

[20170526094212983][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

[20170526094213003][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.

[20170526094213003][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

[20170526094213252][main][DiscoveryClient.<init>]Client configured to neither register nor query for data.

[20170526094213288][main][DiscoveryClient.<init>]Discovery Client initialized at timestamp 1495762933287 with initial instances count: 0

[20170526094213487][main][DefaultEurekaServerContext.initialize]Initializing ...

[20170526094213491][main][PeerEurekaNodes.updatePeerEurekaNodes]Adding new peer nodes [http://127.0.0.1:1100/eureka/]

[20170526094214466][main][DiscoveryJerseyProvider.<init>]Using JSON encoding codec LegacyJacksonJson

[20170526094214467][main][DiscoveryJerseyProvider.<init>]Using JSON decoding codec LegacyJacksonJson

[20170526094214467][main][DiscoveryJerseyProvider.<init>]Using XML encoding codec XStreamXml

[20170526094214468][main][DiscoveryJerseyProvider.<init>]Using XML decoding codec XStreamXml

[20170526094214786][main][PeerEurekaNodes.start]Replica node URL: http://127.0.0.1:1100/eureka/

[20170526094214803][main][AbstractInstanceRegistry.initRemoteRegionRegistry]Finished initializing remote region registries. All known remote regions: []

[20170526094214804][main][DefaultEurekaServerContext.initialize]Initialized

[20170526094215684][Thread-11][PeerAwareInstanceRegistryImpl.openForTraffic]Got 1 instances from neighboring DS node

[20170526094215685][Thread-11][PeerAwareInstanceRegistryImpl.openForTraffic]Renew threshold is: 1

[20170526094215685][Thread-11][PeerAwareInstanceRegistryImpl.openForTraffic]Changing status to UP

[20170526094215879][main][StartupInfoLogger.logStarted]Started ServiceDiscoveryBootStrap in 17.0 seconds (JVM running for 21.803)

[20170526094216690][Eureka-EvictionTimer][AbstractInstanceRegistry$EvictionTask.run]Running the evict task with compensationTime 0ms

[20170526094217690][Eureka-EvictionTimer][AbstractInstanceRegistry$EvictionTask.run]Running the evict task with compensationTime 0ms

访问
locahost:1100

Paste_Image.png

启动服务提供方ServiceServer01

Paste_Image.png

部分日志如下

. ____ _ __ _ _

/\ / _' __ _ () __ __ _ \ \ \ \

( ( )___ | '_ | '| | ' / _` | \ \ \ \

\/ _)| |)| | | | | || (| | ) ) ) )

' |____| .|| ||| |__, | / / / /

=========||==============|/=///_/

:: Spring Boot :: (v1.5.3.RELEASE)

[20170526100135254][main][SpringApplication.logStartupProfileInfo]No active profile set, falling back to default profiles: default

[20170526100137018][main][ConfigurationClassPostProcessor.enhanceConfigurationClasses]Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.

[20170526100145271][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.

[20170526100145277][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

[20170526100145306][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.

[20170526100145306][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

[20170526100148026][main][DiscoveryJerseyProvider.<init>]Using JSON encoding codec LegacyJacksonJson

[20170526100148035][main][DiscoveryJerseyProvider.<init>]Using JSON decoding codec LegacyJacksonJson

[20170526100148322][main][DiscoveryJerseyProvider.<init>]Using XML encoding codec XStreamXml

[20170526100148322][main][DiscoveryJerseyProvider.<init>]Using XML decoding codec XStreamXml

[20170526100148848][main][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration

[20170526100149174][main][DiscoveryClient.fetchRegistry]Disable delta property : false

[20170526100149174][main][DiscoveryClient.fetchRegistry]Single vip registry refresh property : null

[20170526100149177][main][DiscoveryClient.fetchRegistry]Force full registry fetch : false

[20170526100149177][main][DiscoveryClient.fetchRegistry]Application is null : false

[20170526100149177][main][DiscoveryClient.fetchRegistry]Registered Applications size is zero : true

[20170526100149178][main][DiscoveryClient.fetchRegistry]Application version is -1: true

[20170526100149178][main][DiscoveryClient.getAndStoreFullRegistry]Getting all instance registry info from the eureka server

[20170526100149668][main][DiscoveryClient.getAndStoreFullRegistry]The response status is 200

[20170526100149670][main][DiscoveryClient.initScheduledTasks]Starting heartbeat executor: renew interval is: 5

[20170526100149678][main][InstanceInfoReplicator.<init>]InstanceInfoReplicator onDemand update allowed rate per min is 4

[20170526100149684][main][DiscoveryClient.<init>]Discovery Client initialized at timestamp 1495764109684 with initial instances count: 0

[20170526100149798][main][DiscoveryClient$3.notify]Saw local status change event StatusChangeEvent [timestamp=1495764109798, current=UP, previous=STARTING]

[20170526100149823][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CALCULATORSERVER/CalculatorServer:2100: registering service...

[20170526100150570][main][StartupInfoLogger.logStarted]Started ServiceServer01BootStarp in 19.56 seconds (JVM running for 21.528)

[20170526100150593][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CALCULATORSERVER/CalculatorServer:2100 - registration status: 204

[20170526100219672][DiscoveryClient-CacheRefreshExecutor-0][DiscoveryClient.fetchRegistry]Disable delta property : false

刷新localhost:1100,发现多了一个服务:

Paste_Image.png

访问
http://127.0.0.1:2100/add?a=10&b=5

Paste_Image.png

连续访问三次:
http://127.0.0.1:2100/add?a=10&b=5

日志如下:

[20170526101149185][AsyncResolver-bootstrap-executor-0][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration

[20170526101445340][http-nio-2100-exec-1][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=15

[20170526101454636][http-nio-2100-exec-10][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=15

[20170526101506163][http-nio-2100-exec-9][CalculatorController.add]uri=http://172.25.126.162:2100,serviceId=CalculatorServer,result=15

启动服务提供方ServiceServer02
刷新
localhost:1100,发现注册的服务有两个

Paste_Image.png

访问
127.0.0.1:2200/add?a=10&b=10

Paste_Image.png

连续访问两次
127.0.0.1:2200/add?a=10&b=10

日志如下:

[20170526101632306][http-nio-2200-exec-3][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=20

[20170526101641271][http-nio-2200-exec-2][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=20

启动服务消费端ServiceClient01(Ribbon)
部分日志如下

. ____ _ __ _ _

/\ / _' __ _ () __ __ _ \ \ \ \

( ( )___ | '_ | '| | ' / _` | \ \ \ \

\/ _)| |)| | | | | || (| | ) ) ) )

' |____| .|| ||| |__, | / / / /

=========||==============|/=///_/

:: Spring Boot :: (v1.5.3.RELEASE)

[20170526101814445][main][SpringApplication.logStartupProfileInfo]No active profile set, falling back to default profiles: default

[20170526101816285][main][ConfigurationClassPostProcessor.enhanceConfigurationClasses]Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.

[20170526101825222][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.

[20170526101825224][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

[20170526101825255][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.

[20170526101825258][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

[20170526101827448][main][DiscoveryJerseyProvider.<init>]Using JSON encoding codec LegacyJacksonJson

[20170526101827454][main][DiscoveryJerseyProvider.<init>]Using JSON decoding codec LegacyJacksonJson

[20170526101827811][main][DiscoveryJerseyProvider.<init>]Using XML encoding codec XStreamXml

[20170526101827811][main][DiscoveryJerseyProvider.<init>]Using XML decoding codec XStreamXml

[20170526101828342][main][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration

[20170526101828662][main][DiscoveryClient.fetchRegistry]Disable delta property : false

[20170526101828662][main][DiscoveryClient.fetchRegistry]Single vip registry refresh property : null

[20170526101828662][main][DiscoveryClient.fetchRegistry]Force full registry fetch : false

[20170526101828663][main][DiscoveryClient.fetchRegistry]Application is null : false

[20170526101828663][main][DiscoveryClient.fetchRegistry]Registered Applications size is zero : true

[20170526101828663][main][DiscoveryClient.fetchRegistry]Application version is -1: true

[20170526101828663][main][DiscoveryClient.getAndStoreFullRegistry]Getting all instance registry info from the eureka server

[20170526101829165][main][DiscoveryClient.getAndStoreFullRegistry]The response status is 200

[20170526101829167][main][DiscoveryClient.initScheduledTasks]Starting heartbeat executor: renew interval is: 5

[20170526101829181][main][InstanceInfoReplicator.<init>]InstanceInfoReplicator onDemand update allowed rate per min is 4

[20170526101829185][main][DiscoveryClient.<init>]Discovery Client initialized at timestamp 1495765109185 with initial instances count: 2

[20170526101829274][main][DiscoveryClient$3.notify]Saw local status change event StatusChangeEvent [timestamp=1495765109274, current=UP, previous=STARTING]

[20170526101829278][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CLIENT-CONSUMER-RIBBON/client-consumer-ribbon:3100: registering service...

[20170526101829386][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CLIENT-CONSUMER-RIBBON/client-consumer-ribbon:3100 - registration status: 204

[20170526101829694][main][StartupInfoLogger.logStarted]Started ServiceClient01BootStarp in 19.749 seconds (JVM running for 21.296)

访问localhost:1100,发现Application里多了一个Client-consume-ribbon

Paste_Image.png

多次访问(六次)
http://127.0.0.1:3100/toadd 可以看到两个服务端打印的请求日志是均等输出的,各输出三次:

Paste_Image.png

[20170526151033675][http-nio-2100-exec-3][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=30

[20170526151057257][http-nio-2100-exec-1][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=30

[20170526151110916][http-nio-2100-exec-9][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=30

Paste_Image.png

[20170526151036583][http-nio-2200-exec-3][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=30

[20170526151059570][http-nio-2200-exec-1][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=30

[20170526151109162][http-nio-2200-exec-9][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=30

启动服务消费端ServiceClient02(Feign)
部分日志如下:

. ____ _ __ _ _

/\ / _' __ _ () __ __ _ \ \ \ \

( ( )___ | '_ | '| | ' / _` | \ \ \ \

\/ _)| |)| | | | | || (| | ) ) ) )

' |____| .|| ||| |__, | / / / /

=========||==============|/=///_/

:: Spring Boot :: (v1.5.3.RELEASE)

[20170526103133421][main][SpringApplication.logStartupProfileInfo]No active profile set, falling back to default profiles: default

[20170526103135610][main][ConfigurationClassPostProcessor.enhanceConfigurationClasses]Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.

[20170526103143115][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.

[20170526103143116][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

[20170526103143137][main][URLConfigurationSource.<init>]No URLs will be polled as dynamic configuration sources.

[20170526103143138][main][URLConfigurationSource.<init>]To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

[20170526103144853][main][DiscoveryJerseyProvider.<init>]Using JSON encoding codec LegacyJacksonJson

[20170526103144858][main][DiscoveryJerseyProvider.<init>]Using JSON decoding codec LegacyJacksonJson

[20170526103145270][main][DiscoveryJerseyProvider.<init>]Using XML encoding codec XStreamXml

[20170526103145270][main][DiscoveryJerseyProvider.<init>]Using XML decoding codec XStreamXml

[20170526103145932][main][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration

[20170526103146163][main][DiscoveryClient.fetchRegistry]Disable delta property : false

[20170526103146163][main][DiscoveryClient.fetchRegistry]Single vip registry refresh property : null

[20170526103146163][main][DiscoveryClient.fetchRegistry]Force full registry fetch : false

[20170526103146164][main][DiscoveryClient.fetchRegistry]Application is null : false

[20170526103146164][main][DiscoveryClient.fetchRegistry]Registered Applications size is zero : true

[20170526103146164][main][DiscoveryClient.fetchRegistry]Application version is -1: true

[20170526103146164][main][DiscoveryClient.getAndStoreFullRegistry]Getting all instance registry info from the eureka server

[20170526103146695][main][DiscoveryClient.getAndStoreFullRegistry]The response status is 200

[20170526103146697][main][DiscoveryClient.initScheduledTasks]Starting heartbeat executor: renew interval is: 5

[20170526103146700][main][InstanceInfoReplicator.<init>]InstanceInfoReplicator onDemand update allowed rate per min is 4

[20170526103146707][main][DiscoveryClient.<init>]Discovery Client initialized at timestamp 1495765906706 with initial instances count: 3

[20170526103146794][main][DiscoveryClient$3.notify]Saw local status change event StatusChangeEvent [timestamp=1495765906794, current=UP, previous=STARTING]

[20170526103146810][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CLIENT-CONSUMER-FEIGN/client-consumer-feign:3200: registering service...

[20170526103146897][DiscoveryClient-InstanceInfoReplicator-0][DiscoveryClient.register]DiscoveryClient_CLIENT-CONSUMER-FEIGN/client-consumer-feign:3200 - registration status: 204

[20170526103147401][main][StartupInfoLogger.logStarted]Started ServiceClient02BootStarp in 18.382 seconds (JVM running for 19.856)

访问localhost:1100,发现Application多了一个Client-Consume-Feign

Paste_Image.png

访问127.0.0.1:3200/demo/feign/toad?a=11&b=22

Paste_Image.png

多次访问(六次)
http://127.0.0.1:3200/demo/feign/toadd?a=20&b=40

可以看到两个服务端打印的请求日志是均等输出的,各输出三次:

Paste_Image.png

[20170526151424081][http-nio-2100-exec-6][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=60

[20170526151430819][http-nio-2100-exec-5][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=60

[20170526151437541][AsyncResolver-bootstrap-executor-0][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration

[20170526151500833][http-nio-2100-exec-3][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=60

Paste_Image.png

[20170526151428657][http-nio-2200-exec-8][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=60

[20170526151444082][http-nio-2200-exec-5][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=60

[20170526151458507][http-nio-2200-exec-3][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=60

遇到问题:
如果将service-client-01的ConsumerController改为:
<pre>
@RequestMapping(value = "/toadd",method = RequestMethod.GET)**
public int toadd(@RequestParam int a, @RequestParam int b){
InstanceInfo instance = eurekaClient.getNextServerFromEureka(
"CalculatorServer"
,
false
);
Integer r = a + b;
logger.info(
"/add, host:" **+instance.getHostName() + **",serviceId:" **+ instance.getInstanceId() + **",result:" **+ r);
return calculatorService.addService(a, b);}
</pre>

CaculatorService.Class:
<pre>
@Service
**class **CalculatorService {
@Resource
**private *RestTemplate restTemplate;
// @RequestMapping(value="add",method = RequestMethod.GET)****
// int addService(@RequestParam("a") int a,@RequestParam("b") int b){****
// String reqURL = "http://CalculatorServer/add?a=" + a + "&b=" + b;****
// //String reqURL = "http://CalculatorServer:3100/demo/ribbon/toadd?a=" + a + "&b=" +b;****
// return restTemplate.getForEntity(reqURL, Integer.class).getBody();****
//****
// }****
**public int addService(int a,int **b){
String reqURL = **"http://CalculatorServer/add?a=" **+ a + **"&b=" **+ b;
**return restTemplate.getForEntity(reqURL,Integer.class).getBody();
}
}
</pre>

访问:
http://127.0.0.1:3100/toadd?a=100&b=200

报错如下;

**Whitelabel Error Page****
**
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri May 26 16:02:40 CST 2017

There was an unexpected error (type=Bad Request, status=400).

Could not read JSON document: Can not deserialize instance of java.lang.Integer out of START_OBJECT token at [Source: java.io.PushbackInputStream@47bf45de; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.Integer out of START_OBJECT token at [Source: java.io.PushbackInputStream@47bf45de; line: 1, column: 1]

但是四次访问却是负载均衡的:

Paste_Image.png

[20170526161145179][http-nio-2100-exec-5][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=300

[20170526161149228][http-nio-2100-exec-4][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=300

[20170526161437557][AsyncResolver-bootstrap-executor-0][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration

[20170526161450505][http-nio-2100-exec-3][CalculatorController.add]uri=http://172.25.126.162:2100,
serviceId=CalculatorServer,result=300

Paste_Image.png

[20170526161147229][http-nio-2200-exec-8][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=300

[20170526161151024][http-nio-2200-exec-6][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=300

[20170526161314964][AsyncResolver-bootstrap-executor-0][ConfigClusterResolver.getClusterEndpoints]Resolving eureka endpoints via configuration

[20170526161448600][http-nio-2200-exec-5][CalculatorController.add]uri=http://172.25.126.162:2200,
serviceId=CalculatorServer,result=300

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,189评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,577评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,857评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,703评论 1 276
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,705评论 5 366
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,620评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,995评论 3 396
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,656评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,898评论 1 298
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,639评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,720评论 1 330
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,395评论 4 319
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,982评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,953评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,195评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 44,907评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,472评论 2 342

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,594评论 18 139
  • ** 今天看了一下kafka官网,尝试着在自己电脑上安装和配置,然后学一下官方document。** Introd...
    RainChang阅读 4,986评论 1 30
  • EnglishVersion ->_->:https://github.com/jiang111/awesome-...
    聂顺阅读 1,217评论 0 4
  • 今天去售楼处找开发商开具发票,门口有一值班人员,对他说明来意。他说,你跟财务预约了吗?——我说上次他们告诉我,周一...
    坛_阅读 288评论 0 1
  • 大约十年前,第一次开始清晰记得生日 729
    岚风的叶子阅读 179评论 0 0