开发者社区 > 云原生 > 正文

spring-cloud-alibaba 一定要用nacos

我想使用sentinel向尤里卡注册以发现pom.xml文件

4.0.0 org.springframework.boot spring-boot-starter-parent 2.0.3.RELEASE com.cyd.project spring-cloud-alibaba-demo 0.0.1-SNAPSHOT spring-cloud-alibaba-demo Demo project for Spring Boot 1.8 org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-web com.alibaba.cloud spring-cloud-starter-alibaba-sentinel org.springframework.boot spring-boot-starter-test test org.springframework.cloud spring-cloud-starter-netflix-eureka-client 2.0.1.RELEASE org.springframework.cloud spring-cloud-starter-netflix-ribbon 2.0.1.RELEASE org.springframework.boot spring-boot-starter-actuator com.alibaba.cloud spring-cloud-alibaba-dependencies 2.0.0.RELEASE pom import org.springframework.boot spring-boot-maven-plugin

应用程序属性 spring.application.name=sentinel-example server.port=18084 spring.cloud.sentinel.transport.dashboard=localhost:8080 management.endpoint.health.show-details=always management.endpoints.web.exposure.include=* eureka.client.serviceUrl.defaultZone = http://eureka.xxx.cn/eureka/ eureka.client.healthcheck.enabled = true eureka.instance.lease-renewal-interval-in-seconds = 3 eureka.instance.lease-expiration-duration-in-seconds = 3 eureka.client.registerWithEureka = true eureka.client.fetchRegistry = true eureka.instance.prefer-ip-address = true eureka.instance.instance-id = ${spring.cloud.client.ip-address}:${server.port} #logging.level.org.springframework = DEBUG

控制台日志 2019-11-27 15:20:13.367 INFO 17824 --- [ main] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1574839213367, current=UP, previous=STARTING] 2019-11-27 15:20:21.486 INFO 17824 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SENTINEL-EXAMPLE/172.16.56.152:18084: registering service... 2019-11-27 15:20:21.531 INFO 17824 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 18084 (http) with context path '' 2019-11-27 15:20:21.532 INFO 17824 --- [ main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 18084 2019-11-27 15:20:21.534 INFO 17824 --- [ main] .c.a.d.SpringCloudAlibabaDemoApplication : Started SpringCloudAlibabaDemoApplication in 14.244 seconds (JVM running for 14.897) 2019-11-27 15:20:21.576 INFO 17824 --- [tbeatExecutor-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SENTINEL-EXAMPLE/172.16.56.152:18084 - Re-registering apps/SENTINEL-EXAMPLE 2019-11-27 15:20:21.576 INFO 17824 --- [tbeatExecutor-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SENTINEL-EXAMPLE/172.16.56.152:18084: registering service... 2019-11-27 15:20:21.644 INFO 17824 --- [tbeatExecutor-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SENTINEL-EXAMPLE/172.16.56.152:18084 - registration status: 204 2019-11-27 15:20:21.644 INFO 17824 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SENTINEL-EXAMPLE/172.16.56.152:18084 - registration status: 204 INFO: log base dir is: C:\Users\l\logs\csp
INFO: log name use pid is: false 2019-11-27 15:20:27.553 WARN 17824 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1574839221675, current=DOWN, previous=UP]

可以看到尤里卡的注册状态已经从上到下变化,并且不会改变。除非我在服务中手动调整界面几次,否则他就会起床。 spring-cloud-alibaba 2.1.0.RELEASE也是这样的

原提问者GitHub用户p555iii

展开
收起
白夜行fighting 2023-06-11 10:12:50 74 0
1 条回答
写回答
取消 提交回答
  • 不,所有组件都是可选的。

    原回答者GitHub用户fangjian0423

    2023-06-11 11:16:47
    赞同 展开评论 打赏

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载
阿里特邀专家徐雷Java Spring Boot开发实战系列课程(第18讲):制作Java Docker镜像与推送到DockerHub和阿里云Docker仓库 立即下载

相关实验场景

更多