Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

初始化nacos失败 问题 #718

Open
jiayb opened this issue Jan 26, 2024 · 1 comment
Open

初始化nacos失败 问题 #718

jiayb opened this issue Jan 26, 2024 · 1 comment

Comments

@jiayb
Copy link

jiayb commented Jan 26, 2024

golang 1.17
nacos服务端是 2.1.2
nacos客户端是 github.com/nacos-group/nacos-sdk-go v1.1.4

问题描述 :
我本地启动注册nacos的时候在这一步会报错

success, err := client.RegisterInstance(
vo.RegisterInstanceParam{
Ip: serverIp, // 配置自己IP 表示谁都可以访问
Port: runPort,
Weight: 10,
Enable: true, // true表示可以访问 其他服务可以根据nacos访问到这个服务
Healthy: true, // true表示是否健康
Metadata: nil, // 选填
ClusterName: clusters, //集群名称 表示要连接哪个nacos服务
ServiceName: tenantCode, //在这里租户编码作为service name
GroupName: groupName, // 默认不写为default
Ephemeral: true,
})
if !success {
log.LOGGER("SSO").Error("初始化nacos失败 : ", err)
}

返回的错误是
%!(EXTRA *errors.errorString=retry3times request failed,err=Post "http://10.1xx.xx.xxx:8848/nacos/v1/ns/insta
nce": context deadline exceeded (Client.Timeout exceeded while awaiting headers))

然后就是注册不上去,过一会 又能注册上去 ,很奇怪

@binbin0325
Copy link
Member

超时了,网络有问题。另外nacos server是2.x版本,建议sdk也用2.x版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants