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

无法链接本地的etcd客户端 无法写入 #939

Closed
sjfxy opened this issue Aug 23, 2021 · 27 comments
Closed

无法链接本地的etcd客户端 无法写入 #939

sjfxy opened this issue Aug 23, 2021 · 27 comments

Comments

@sjfxy
Copy link

sjfxy commented Aug 23, 2021

{"level":"warn","ts":"2021-08-23T17:23:44.850+0800","logger":"etcd-client","caller":"[email protected]/retry_interceptor.go:62","msg":"retrying of
unary invoker failed","target":"etcd-endpoints://0xc0001a1880/#initially=[192.168.1.57:2379]","attempt":0,"error":"rpc error: code = Dead
lineExceeded desc = latest balancer error: last connection error: connection error: desc = "transport: Error while dialing dial tcp 0.0.0
.0:2379: connectex: No connection could be made because the target machine actively refused it.""}
{"level":"info","ts":"2021-08-23T17:23:44.850+0800","logger":"etcd-client","caller":"[email protected]/client.go:207","msg":"Auto sync endpoints f
ailed.","error":"context deadline exceeded"}

@kevwan
Copy link
Contributor

kevwan commented Aug 23, 2021

如果是本机,你试试localhost

@sjfxy
Copy link
Author

sjfxy commented Aug 23, 2021

rpc dial: discov://localhost:2379/add.rpc, error: context deadline exceeded, make sure rpc service "add.rpc" is already started
api中连接 add.prc 耗时无法查询到
rpc服务启动也没有注册 rpc服务貌似没有写入到etcd puslish 进去

@kevwan
Copy link
Contributor

kevwan commented Aug 24, 2021

rpc dial: discov://localhost:2379/add.rpc, error: context deadline exceeded, make sure rpc service "add.rpc" is already started

api中连接 add.prc 耗时无法查询到

rpc服务启动也没有注册 rpc服务貌似没有写入到etcd puslish 进去

  • 确保etcd启动正常且可访问
  • 确保rpc服务已启动

@sjfxy
Copy link
Author

sjfxy commented Aug 24, 2021

环境: etcd 安装如下:
docker run -d -p 2379:2379 -p 2380:2380 --mount type=bind,source=/tmp/etcd-data.tmp,destination=/etcd-data --name etcd-sin quay.io/coreos/etcd:v3.5.0 /usr/local/bin/etcd --name s1 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster s1=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new

安装完etcd如下:
image

机器访问:
image

rpc-test服务:

image

本地测试: etcd 是否正常 google.golang.org/grpc:v1.26.0
image

rpc服务启动过一度时间出现:

"logger":"etcd-client","caller":"[email protected]/retry_interceptor.go:62","msg":"retrying of una
ry invoker failed","target":"etcd-endpoints://0xc000380540/#initially=[192.168.132.130:2379]","attempt":0,"error":"rpc error: code = DeadlineE
xceeded desc = latest balancer error: last connection error: connection error: desc = "transport: Error while dialing dial tcp 0.0.0.0:2379:
connectex: No connection could be made because the target machine actively refused it.""}
{"level":"info","ts":"2021-08-24T09:02:26.789+0800","logger":"etcd-client","caller":"[email protected]/client.go:207","msg":"Auto sync endpoints faile
d.","error":"context deadline exceeded"}

@sjfxy
Copy link
Author

sjfxy commented Aug 24, 2021

只能单个服务注册吗 我看都是注册的是单个服务 有 服务名称+path这种的吗 就是service 公用一个servicenamepace 去调用对应的方法

@sjfxy
Copy link
Author

sjfxy commented Aug 24, 2021

类似 servicename.namespace.svc.cluster.local 的形式

@sjfxy
Copy link
Author

sjfxy commented Aug 24, 2021

image
自己在api中 调用rpc服务 原生的grpc本身就可以支持获取Conn 不同的方法传递的呀 到这边怎么不行了

@sjfxy
Copy link
Author

sjfxy commented Aug 24, 2021

希望支持
image
image
image
现在不支持

@kevwan
Copy link
Contributor

kevwan commented Aug 24, 2021

加我微信沟通下吧,没太明白

@sjfxy
Copy link
Author

sjfxy commented Aug 24, 2021 via email

@kevwan
Copy link
Contributor

kevwan commented Aug 25, 2021

微信多少

kevwan

@bmjssd
Copy link

bmjssd commented Aug 25, 2021

同样问题,怎么解决的?

@sjfxy
Copy link
Author

sjfxy commented Aug 26, 2021

单独的注入客户端没有问题 注入相同的客户端 公用一个链接 conn 句柄 导致问题 请查看 svcContext 注入的rpc客户端是否配置了conn zrpc.MustClient 传入的是grpc.Conn 实例 可以自己随便的扩展 使用consul etcd java的配置服务发现中心 只需要继承 client.Client 的 Conn 方法即可

@sjfxy sjfxy closed this as completed Aug 26, 2021
@hoysoft
Copy link

hoysoft commented Oct 9, 2021

xxx.log.rpc 这种形式,多个相同的客户端有解决方案了吗?

@sjfxy
Copy link
Author

sjfxy commented Oct 9, 2021 via email

@gocpplua
Copy link

请问这个问题后来有解决吗

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Has this issue been resolved later?

@gocpplua
Copy link

请问这个问题后来有解决吗

因为我使用的etcd版本是2.2.5,升级到3.5.2就没有存在这个问题了

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Is this problem solved later?

Because the etcd version I am using is 2.2.5, this problem does not exist after upgrading to 3.5.2

@sjfxy
Copy link
Author

sjfxy commented Mar 22, 2022 via email

@sjfxy
Copy link
Author

sjfxy commented Mar 22, 2022 via email

@1369521908
Copy link

请检查是否为启用了代理 可以尝试关闭GoLand代理看看

image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Please check if the proxy is enabled, you can try to close the GoLand proxy

image

@AiLiaa
Copy link

AiLiaa commented Nov 22, 2023

解决了吗

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Solve it

@enjo2023
Copy link

解决了吗

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Is it solved?

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

9 participants