巨坑1: Spring cloud zuul 代理服務報錯

這個巨坑斷斷續續的花了快一週的時間, 整個人都不好了, 必須記錄一下.

Zuul 代理 請求服務;

請求服務A: OK

請求服務B: 報錯; 信息如下:

2018-07-13 13:25:09.193 [http-nio-9602-exec-10] WARN  o.s.c.netflix.zuul.filters.post.SendErrorFilter - Error during filtering
com.netflix.zuul.exception.ZuulException: Forwarding error

Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: product

剛開始有點兒懵, 完全懵了, 不知道爲啥, 從哪裏下手; 谷歌百度也沒有多少資料;

比對了服務A和B的所有配置: build.gradle依賴配置; springboot版本號, clould版本號; 配置中心, 註冊中心等等配置, 一毛一樣; 不一樣的改到一樣;

最後, 老老實實的比對啓動日誌:

//服務A
o.s.c.consul.serviceregistry.ConsulServiceRegistry - Registering service with consul: NewService{id='funds-local-9004', name='funds', tags=[], address='172.31.40.97', port=9004, enableTagOverride=null, check=Check{script='null', interval='10s', ttl='null', http='http://172.31.40.97:9004/', tcp='null', timeout='null', deregisterCriticalServiceAfter='null', tlsSkipVerify=null, status='null'}, checks=null}

//服務B
o.s.c.consul.serviceregistry.ConsulServiceRegistry - Registering service with consul: NewService{id='f-product-local-9006', name='f-product', tags=[], address='172.31.40.97', port=8500, enableTagOverride=null, check=Check{script='null', interval='10s', ttl='null', http='http://172.31.40.97:8500/health', tcp='null', timeout='null', deregisterCriticalServiceAfter='null', tlsSkipVerify=null, status='null'}, checks=null}

看了好多次,沒看出毛病, 最後一比對, 發現: port=8500, 這裏明顯不對, 這特麼不是Consul的port麼, 怎麼會這樣!!!

唯一的區別, 服務A的配置文件是 .properties的, 服務B 是.yml的. 

換成properties的, 問題解決

what the fu********ck!

 

罪案現場:: 

// zuul dependency version: 

springBootVersion = '2.0.3.RELEASE'

ext {
	springCloudVersion = 'Finchley.RELEASE'
}

//Server A & B
ext {
		springBootVersion = '1.5.10.RELEASE'
	}

mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Edgware.SR3'

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章