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

fix: Nacos integration with SpringBootAdmin.(2022.x) #3318

Merged
merged 2 commits into from May 22, 2023

Conversation

zhangbinhub
Copy link
Contributor

Describe what this PR does / why we need it

Refactor GatewayLocatorHeartBeatPublisher to enable friendly subscription to HeartBeat events in addition to the gateway

Does this pull request fix one issue?

Refer #3258

Describe how you did it

  1. GatewayLocatorHeartBeatPublisher migrate to NacosDiscoveryHeartBeatPublisher.
  2. Add properties spring.cloud.nacos.discovery.heart-beat.enabled to enable NacosDiscoveryHeartBeatPublisher, default is false .
  3. Optimize the lifecycle of NacosDiscoveryHeartBeatPublisher, set running correctly after start and stop.
  4. Separate NacosDiscoveryHeartBeatConfiguration and use conditional combinations compatible with spring cloud gateway, spring boot admin, and others.

…binations compatible with spring cloud gateway, spring boot admin, and others
@ruansheng8
Copy link
Collaborator

LGTM

@@ -355,5 +355,6 @@ spring.cloud.nacos.discovery.ip-type=IPv6
|接入点|`spring.cloud.nacos.discovery.endpoint`||地域的某个服务的入口域名,通过此域名可以动态地拿到服务端地址
|是否集成LoadBalancer|`spring.cloud.loadbalancer.nacos.enabled`|`false`|
|是否开启Nacos Watch|`spring.cloud.nacos.discovery.watch.enabled`|`false`|可以设置成 true 来开启 watch
|是否开启Nacos Discovery HeartBeat|`spring.cloud.nacos.discovery.heart-beat.enabled`|`false`|可以设置成 true 来开启 heart beat
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heartbeat is a word. I think use spring.cloud.nacos.discovery.heartbeat.enabled is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heartbeat is a word. I think use spring.cloud.nacos.discovery.heartbeat.enabled is better.

I saw that other configurations are also named like this, so I referred to them.
e.g. spring.cloud.nacos.discovery.heart-beat-timeout
Of course, I strongly support replacing it with heartbeat.Do I need to change to heartbeat?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@steverao steverao May 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spring.cloud.nacos.discovery.heart-beat-timeout

I didn't notice it before, so let's keep it consistent

Copy link
Collaborator

@steverao steverao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @zhangbinhub

@steverao steverao merged commit 53d466f into alibaba:2022.x May 22, 2023
3 checks passed
@zhangbinhub zhangbinhub deleted the fix-nacos-hearbeat-2022.x branch May 22, 2023 15:21
@GordonLoo
Copy link

所以在nacos整合spring boot admin的时候我要进行什么配置才能实现SBA的上下线监听?我使用spring.cloud.nacos.discovery.heart-beat.enabled=true似乎不起作用。

@ruansheng8
Copy link
Collaborator

ruansheng8 commented Jan 17, 2024

所以在nacos整合spring boot admin的时候我要进行什么配置才能实现SBA的上下线监听?我使用spring.cloud.nacos.discovery.heart-beat.enabled=true似乎不起作用。

sba 针对服务的上下线监听实际上是通过 actuator health 接口来判断的,

  1. 你需要检查一下你的项目里面是否引入了 spring boot actuator 相关依赖,并访问 /actuator/health/liveness 检查该接口否是正常
  2. 确认 sba 服务端有正确注册到nacos

如果上面2个步骤确认没有问题,可以单独提交一个 issue 详细说明一下你遇到的问题

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

Successfully merging this pull request may close these issues.

None yet

4 participants