nacos-sdk-go v2 報錯提示客戶端連接不上
標籤(空格分隔): nacos
前言
nacos版本:v2
nacos-sdk-go版本:v2
背景:使用nacos-sdk-go來獲取配置,發現一直在找緩存目錄的文件,但使用openapi可以獲取到配置
報錯信息
client not connected, current status:STARTING
提示客戶端連接失敗???
1999-07-03T17:28:05.561+0800 ERROR config_client/config_client.go:208 get config from server error:client not connected, current status:STARTING, dataId=test, group=DEFAULT_GROUP, namespaceId=
1999-07-03T17:28:05.561+0800 ERROR cache/disk_cache.go:101 get config from cache, cacheKey:test@@DEFAULT_GROUP@@, cacheDir:tmp/nacos/cache\config, error:open tmp/nacos/cache\config\test@@DEFAULT_GROUP@@: The system cannot find the path specified.
client not connected, current status:STARTING
解決方案
文檔地址:https://nacos.io/zh-cn/docs/v2/upgrading/2.0.0-compatibility.html
原因:Nacos2.0增加了9848,9849端口來進行GRPC通信
docker啓動nacos增加相應的端口
docker run --name nacos-standalone -e MODE=standalone -e JVM_XMS=100m -e JVM_XMX=100m -e JVM_XMN=100m -p 8848:8848 -p 9848:9848 -p 9849:9849 -d nacos/nacos-server:latest