go-zero
go-zero copied to clipboard
Issues with RPC registration to Etcd.
5个节点的 etcd 集群,两个服务器运行同一个rpc服务。运行一段时间后,etcd中的key 变得很多,如下图所示都是同一个key 但是有2w多个。
- The error is
Environments :
- OS: Ubuntu
- go-zero version 1.8.4
- goctl version 1.24.1
What's your server code? It seems the server registered many times.
My gRPC configuration is ï¼
Name: product.gorpc.rpc
ListenOn: 0.0.0.0:3031
Mode: pro
Timeout: 20000
Log:
Level: info
Mode: file
KeepDays: 10
Middlewares:
Timeout: true
Etcd:
User: "root"
Pass: "123!@#QWE"
Hosts:
- 191.56.28.210:2230
Key: productService/GoRpc.rpc
Mysql:
DataSource: "root:123123@tcp(123.123.123:3603)/product_online?charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai"
Prometheus:
Host: 0.0.0.0
Port: 3032
Path: /metrics
After the program runs normally for a period of time, the above issue occurs, and the number of registrations increases over time, feeling like go-zero is continuously repeating the registration.
main.go :
service_context.go:
检查 RPC 服务到 Etcd 的网络稳定性,确保 KeepAlive 正常。确认 Etcd 集群健康度。随后清理 Etcd 中重复的过期 Key。 如果etcd 是集群,最好列出所有节点,增加容错性。