7

Nacos 作为配置中心,微服务总是过段时间自行宕机下线

 2 years ago
source link: https://www.v2ex.com/t/809836
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

nacos 环境

阿里云 ECS,8 核心 16G,CentOS 7.8,同时运行 nacos 和各种微服务。

nacos 运行的版本:2.0.3 。

nacos 为单机运行非集群,启动命令 ./startup.sh -m standalone (使用的是 dev 账户启动的,非 root)

nacos 的配置文件 nacos/conf/application.properties 中没有配置 mysql 链接信息。

含多个服务(约 7 个微服务),微服务中的依赖版本:

    <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

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK