-
Notifications
You must be signed in to change notification settings - Fork 339
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
grpc通过endpoint连接服务端失败 #678
Comments
endpoint 中要配置port |
不是这个意思,我这边已经正确拿到了nacos的集群ip,在构建serverconfig的时候,sdk里赋值了port为8848,但是grpcport值并没有赋值,按道理应该是8848+1000得到的,所以报错信息里显示连接nacos服务端时grpcport为0 |
默认会对port+1000 作为grpc port func (c *GrpcClient) createNewConnection(serverInfo ServerInfo) (*grpc.ClientConn, error) {
var opts []grpc.DialOption
opts = append(opts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(getMaxCallRecvMsgSize())))
opts = append(opts, grpc.WithKeepaliveParams(getKeepAliveTimeMillis()))
opts = append(opts, grpc.WithInsecure())
opts = append(opts, grpc.WithInitialWindowSize(getInitialWindowSize()))
opts = append(opts, grpc.WithInitialConnWindowSize(getInitialConnWindowSize()))
rpcPort := serverInfo.serverGrpcPort
if rpcPort == 0 {
rpcPort = serverInfo.serverPort + c.rpcPortOffset()
}
return grpc.Dial(serverInfo.serverIp+":"+strconv.FormatUint(rpcPort, 10), opts...)
} |
明白了,这块的日志能不能改善一下呢? |
欢迎提交pr进行优化 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of nacos-sdk-go are you using?
2.2.2
What version of nacos-sever are you using?
2.2.2
What version of Go are you using (
go version
)?go1.21.0
What operating system (Linux, Windows, …) and version?
Linux
What did you do?
If possible, provide a recipe for reproducing the error.
使用endpoint访问nacos集群,客户端定时访问endpoint获取nacos ip列表,进而直连ip
What did you expect to see?
成功连接
What did you see instead?
连接失败,检查发现,grpcport为0,定位发现refreshServerSrvIfNeed时,生成的ServerConfig没有携带grpcport
The text was updated successfully, but these errors were encountered: