Nacos重启后微服务项目启动时后端出现NacosException: failed to req API异常解决办法

有时候重启Nacos(大多数情况下是因为重启了机器),再启动微服务项目的服务时,后端控制台会出现NacosException: failed to req API异常。
解决办法: 现有两种解决办法可供参考:
一、如果未做过特殊配置,直接删除(或重命名)protocol文件夹即可
protocol文件夹在安装目录的下列位置:

...\nacos-server-1.4.0\data\

二、如果有特殊配置,修改文件raft_meta、__raft_snapshot_meta中的IP
raft_meta和__raft_snapshot_meta位置如下:

...\nacos-server-1.4.0\data\protocol\raft\naming_persistent_service\meta-data

...\nacos-server-1.4.0\data\protocol\raft\naming_persistent_service\snapshot\snapshot_7(此处可能不是_7,视具体情况而定)

注意: IP要修改为Nacos所在机器的当前IP。

小编遇到过的部分异常记录如下:

2021-02-21 12:24:04.729  INFO 15344 --- [  restartedMain] com.alibaba.nacos.client.naming          : [REGISTER-SERVICE] public registering service DEFAULT_GROUP@@hotbuy-orders with instance: {"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ip":"192.168.0.104","ipDeleteTimeout":30000,"metadata":{"preserved.register.source":"SPRING_CLOUD"},"port":7000,"weight":1.0}
2021-02-21 12:24:04.754 ERROR 15344 --- [  restartedMain] com.alibaba.nacos.client.naming          : request: /nacos/v1/ns/instance failed, servers: [127.0.0.1:8848], code: 503, msg: server is DOWN now, please try again later!
2021-02-21 12:24:04.761 ERROR 15344 --- [  restartedMain] c.a.c.n.registry.NacosServiceRegistry    : nacos registry, hotbuy-orders register failed...NacosRegistration{nacosDiscoveryProperties=NacosDiscoveryProperties{serverAddr='127.0.0.1:8848', endpoint='', namespace='', watchDelay=30000, logName='', service='hotbuy-orders', weight=1.0, clusterName='DEFAULT', group='DEFAULT_GROUP', namingLoadCacheAtStart='false', metadata={preserved.register.source=SPRING_CLOUD}, registerEnabled=true, ip='192.168.0.104', networkInterface='', port=7000, secure=false, accessKey='', secretKey='', heartBeatInterval=null, heartBeatTimeout=null, ipDeleteTimeout=null}},com.alibaba.nacos.api.exception.NacosException: failed to req API:/api//nacos/v1/ns/instance after all servers([127.0.0.1:8848]) tried: server is DOWN now, please try again later!
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师:CSDN官方博客 返回首页