nacos 运行的版本:2.0.3 。
nacos 为单机运行非集群,启动命令 ./startup.sh -m standalone (使用的是 dev 账户启动的,非 root)
nacos 的配置文件 nacos/conf/application.properties 中没有配置 mysql 链接信息。
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
</parent>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2020.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2021.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
版本参考的是: https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E
nacos 是正常启动的,微服务启动注册到 127.0.0.1:8848(使用的是 dev 账户启动的,非 root)
只用到了注册服务,服务发现,没有用到别的 nacos 功能
spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
微服务都能够正常注册到 nacos,但是,过段时间(晚上 18 点重启微服务),次日早上微服务便会自动停机,nacos 后台管理系统中就看到微服务下线了(很多个微服务都下线),这些微服务的日志为:
2021-10-22 11:00:41.433 WARN 19068 --- [ Thread-10] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Start destroying Publisher
2021-10-22 11:00:41.433 WARN 19068 --- [ Thread-10] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Destruction of the end
2021-10-22 11:00:41.436 WARN 19068 --- [ Thread-4] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Start destroying common HttpClient
2021-10-22 11:00:41.437 WARN 19068 --- [ Thread-4] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Destruction of the end
2021-10-22 11:00:41.444 INFO 19068 --- [extShutdownHook] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'Nacos-Watch-Task-Scheduler'
2021-10-22 11:00:41.445 INFO 19068 --- [extShutdownHook] c.a.c.n.registry.NacosServiceRegistry : De-registering from Nacos Server now...
2021-10-22 11:00:41.448 INFO 19068 --- [extShutdownHook] c.a.c.n.registry.NacosServiceRegistry : De-registration finished.
2021-10-22 11:00:49.101 WARN 19068 --- [extShutdownHook] o.s.b.f.support.DisposableBeanAdapter : Destroy method 'close' on bean with name 'nacosServiceRegistry' threw an exception: java.lang.NullPointerException
1
devswork OP |
2
devswork OP 忘了贴了,微服务中依赖的 nacos:
``` <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <version>2021.1</version> <exclusions> <exclusion> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-ribbon</artifactId> </exclusion> </exclusions> </dependency> ``` |
3
leafre 2021-10-22 16:25:31 +08:00 via Android
|
4
jingslunt 2021-10-22 17:44:58 +08:00
改用 consul
|
5
fff333 2021-10-22 18:01:52 +08:00 via Android
eureka
|
6
EarthChild 2021-10-22 20:55:52 +08:00
抛弃阿里巴巴 拥抱其他技术吧。
|
7
devswork OP @EarthChild 为啥? nacos 普遍认为不好用吗。。。。。
|
9
EarthChild 2021-10-22 21:10:08 +08:00
@devswork #7 阿里系技术… 总感觉有点扭曲
|
11
leafre 2021-10-22 21:25:08 +08:00
除了老项目,新项目不应该使用停止开源计划的 eureka
|
12
fff333 2021-10-22 21:27:46 +08:00 via Android
@leafre 现在推荐用啥? 我们公司是祖传代码,eureka,rubicon,feign 一把梭了。
|
14
devswork OP 一觉醒来,好几个人收藏了帖子。。。。。都有这个问题?
|
15
devswork OP 有提供解决问题的思路吗...
|