Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nacos作服务注册中心时某种情况下spring cloud gateway无法注册进入nacos server #3214

Closed
hzwei206 opened this issue Mar 17, 2023 · 7 comments
Labels

Comments

@hzwei206
Copy link

hzwei206 commented Mar 17, 2023

我遇到一个奇葩现象,不知道是什么原因,特来请教:

使用nacos作服务发现。

当nacos里server list有微服务时,启动spring cloud gateway无法注册进入nacos server,并且启动过程卡住了无法启动完成,在nacos里没有gateway服务,观察spring cloud gateway启动日志也无错误,还正常向nacos拉取了微服务server list。

23-03-17 18:25:10.276 [com.alibaba.nacos.naming.failover] DEBUG failover switch is not found, failover00-00---000-VIPSRV_FAILOVER_SWITCH-000---00-00 (c.a.n.c.n.b.FailoverReactor$SwitchRefresher.run[line:147])  

23-03-17 18:25:15.277 [com.alibaba.nacos.naming.failover] DEBUG failover switch is not found, failover00-00---000-VIPSRV_FAILOVER_SWITCH-000---00-00 (c.a.n.c.n.b.FailoverReactor$SwitchRefresher.run[line:147])  

23-03-17 18:25:16.685 [com.alibaba.nacos.client.naming.updater] DEBUG HTTP method: GET, url: http://192.168.1.36:8848/nacos/v1/ns/instance/list?app=unknown&healthyOnly=false&namespaceId=public&clientIP=127.0.0.1&serviceName=DEFAULT_GROUP%40%40one-server&udpPort=37923&accessToken=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJuYWNvcyIsImV4cCI6MTY3OTA2NTE2NX0.adyHWCSc4FOnsGv4hMDbToYA6RtF3rQpWD5KyYdrm54&clusters=, body: {} (c.a.n.c.h.c.NacosRestTemplate.execute[line:476])  

23-03-17 18:25:16.685 [com.alibaba.nacos.client.naming.updater] DEBUG HTTP method: GET, url: http://192.168.1.36:8848/nacos/v1/ns/instance/list?app=unknown&healthyOnly=false&namespaceId=public&clientIP=127.0.0.1&serviceName=DEFAULT_GROUP%40%40another-server&udpPort=37923&accessToken=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJuYWNvcyIsImV4cCI6MTY3OTA2NTE2NX0.adyHWCSc4FOnsGv4hMDbToYA6RtF3rQpWD5KyYdrm54&clusters=, body: {} (c.a.n.c.h.c.NacosRestTemplate.execute[line:476])  

23-03-17 18:25:20.277 [com.alibaba.nacos.naming.failover] DEBUG failover switch is not found, failover00-00---000-VIPSRV_FAILOVER_SWITCH-000---00-00 (c.a.n.c.n.b.FailoverReactor$SwitchRefresher.run[line:147])

当把nacos里的微服务都停掉后,nacos里没有微服务时,再启动spring cloud gateway就能注册进入nacos里,在nacos里能看到gateway服务,spring cloud gateway也正常启动成功,然后再启动其他微服务,一切正常。

nacos版本2.2.0.1
spring cloud版本2021.0.5
spring boot版本2.6.13
spring-cloud-starter-alibaba-nacos-discovery版本2021.1

@steverao
Copy link
Collaborator

Please refer to the document to set the component's dependencies version firstly.

@hzwei206
Copy link
Author

Please refer to the document to set the component's dependencies version firstly.

也就是说我用的pring cloud 2021.0.5,只能用spring-cloud-starter-alibaba-nacos-discovery版本2021.0.4.0*,nacos版本2.0.4,对吧

@hzwei206
Copy link
Author

Please refer to the document to set the component's dependencies version firstly.

不像是版本问题。换了版本测试:
nacos版本2.0.4
spring cloud版本2021.0.5 或 2021.0.4
spring boot版本由cloud版本依赖确定
spring-cloud-starter-alibaba-nacos-discovery版本2021.0.4.0

当nacos里有微服务时,启动gateway,无法启动完成(卡住了),且没有注册进nacos里
不知道是哪里的配置不对?

@hzwei206
Copy link
Author

临时解决办法:
参见 gh-2574

@github-actions
Copy link

This issue has been open 30 days with no activity. This will be closed in 7 days.

@github-actions github-actions bot added the stale label Apr 21, 2023
@github-actions
Copy link

github-actions bot commented May 8, 2023

This issue has been automatically marked as stale because it hasn't had any recent activity.If you think this should still be open, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. Thank you for your interest and contribution to the Sping Cloud Alibaba Community.

@humaolin
Copy link

排查是否缺少loaderbanlance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants