Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Implementation method of spring boot admin Monitoring Integrated nacos Service

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "the implementation of spring boot admin monitoring and integration of nacos services", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "the implementation of spring boot admin monitoring integrated nacos service"!

Testing requires three usage services: nacos registry, spring boot admin monitoring service (integrated nacos client), and testing service (integrated nacos client)

1, nacos registry

Download nacos-server.jar and start it. The default port is 8848 and the default account password is: nacos.

2, spring boot admin monitoring service

2.1.6.RELEASE 2.1.6 2.1.0.RELEASE com.alibaba.cloud spring-cloud-alibaba-dependencies ${ Spring.cloud.alibaba.version} pom import de.codecentric spring-boot-admin- Starter-server ${spring.boot.admin.version} org.springframework.boot spring-boot-starter-jetty Org.springframework.boot spring-boot-starter-mail com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery

Spring boot admin detailed implementation reference: https://www.cnblogs.com/forezp/p/10242004.html

Spring-cloud-starter-alibaba-nacos-discovery has been added here

Configuration item changes:

# spring.boot.admin.client.url= http://127.0.0.1#spring.boot.admin.client.username=${spring.application.name}#spring.boot.admin.client.password=password##spring.boot.admin.client.instance.name=${spring.application.name}#spring.boot.admin.client.instance.service-base-url=http://localhost:8081#spring.boot.admin.client.instance.metadata.user.name=name#spring.boot.admin.client.instance.metadata.user.password=password

Spring boot admin client-related configuration is no longer required and can be automatically discovered through service registration

Spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848spring.cloud.nacos.discovery.metadata.user.name=namespring.cloud.nacos.discovery.metadata.user.password=passwordspring.cloud.nacos.discovery.metadata.management.context-path=/admin/actuator

What needs to be noted here is the configuration related to metadata.

Spring.cloud.nacos.discovery.metadata.user.name=name

Spring.cloud.nacos.discovery.metadata.user.password=password

Add these two items. Basic auth will be used to log in by default.

Spring.cloud.nacos.discovery.metadata.management.context-path=/admin/actuator

The prefix of the actuator request is specified here, including the prefix of the server.servlet.context-path configuration. This configuration is the key point. It took a long time to find that when your actuator endpoint configuration is not the default / actuator, that is: management.endpoints.web.base-path=/admin/actuator.

3. Testing service

When there is no nacos, spring-boot-admin-starter-client is integrated.

De.codecentric spring-boot-admin-starter-client 2.1.6

With nacos, you don't need spring-boot-admin-starter-client. Replace it with spring-cloud-starter-alibaba-nacos-discovery.

Com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery 2.1.0.RELEASE

This service is used to check whether the service is available, which is basically the same as the 2 configuration, but there is no spring boot admin

After all three services are started, you can see the monitoring information of two services (the first and the second) on the second service.

At this point, I believe you have a deeper understanding of "the implementation of spring boot admin monitoring integrated nacos services". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report