go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

How to specify rpc endpoints in API services?

Open themoonbear opened this issue 3 years ago • 5 comments

API服务和RPC服务都是多节点, 使用etcd做节点发现, RPC服务使用grpc的双向流, API服务如何连接指定的RPC节点

themoonbear avatar Aug 20 '22 02:08 themoonbear

Endpoints in yaml.

kevwan avatar Aug 20 '22 14:08 kevwan

Endpoints in yaml.

感谢回复, 我想在API服运行起来之后, 根据参数动态的去连接RPC服, 目前只知道RPC的名字, 但不知道有几个RPC节点, 是不是需要自己来监听etcd呢? 还是说zero有接口可以获得当前有几个rpc节点?

themoonbear avatar Aug 20 '22 14:08 themoonbear

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


Endpoints in yaml.

Thanks for the reply, I want to dynamically connect to the RPC server according to the parameters after the API server is running. At present, I only know the name of the RPC, but I don't know how many RPC nodes there are. Do I need to monitor etcd by myself? The interface can get how many rpc nodes there are currently?

Issues-translate-bot avatar Aug 20 '22 14:08 Issues-translate-bot

Etcd in yaml.

kevwan avatar Aug 20 '22 14:08 kevwan

Go-zero has implemented ETCD's automatic service discovery capability, you can check https://github.com/zeromicro/zero-examples/blob/main/rpc/client/lb/main.go#L30

re-dylan avatar Aug 22 '22 12:08 re-dylan

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Aug 28 '23 01:08 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Mar 16 '24 01:03 github-actions[bot]