Nacos重啟后微服務(wù)項(xiàng)目啟動(dòng)時(shí)后端出現(xiàn)NacosException: failed to req API異常解決辦法

有時(shí)候重啟Nacos(大多數(shù)情況下是因?yàn)橹貑⒘藱C(jī)器),再啟動(dòng)微服務(wù)項(xiàng)目的服務(wù)時(shí),后端控制臺(tái)會(huì)出現(xiàn)NacosException: failed to req API異常。

解決辦法:?現(xiàn)有兩種解決可供參考:

一、如果未做過(guò)特殊配置,直接刪除(或重命名)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所在機(jī)器的當(dāng)前IP。

小編遇到過(guò)的部分異常記錄如下:

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!

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容