How to detect whether an etcd member is a learner? #18232
-
If I add an etcd node to a cluster as a learner, the Unfortunately, when I then try to do any gRPC operations against this member, I get an error that the RPC is not supported by learners: {"level":"warn","ts":"2024-06-25T15:03:10.490565+0200","logger":"etcd-client","caller":"[email protected]/retry_interceptor.go:62","msg":"retrying of unary invoker failed","target":"etcd-endpoints://0x140000141e0/localhost:2379","attempt":30,"error":"rpc error: code = Unavailable desc = etcdserver: rpc not supported for learner"} Is there any easy health-check that will tell me whether the node I am connecting to is a learner or a full member? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @kwohlfahrt - Thanks for your question. For this use case you could wire up a health check based on ➜ ./etcdctl endpoint status -w json
[{"Endpoint":"127.0.0.1:2379","Status":{"header":{"cluster_id":14841639068965178418,"member_id":10276657743932975437,"revision":1,"raft_term":2},"version":"3.6.0-alpha.0","dbSize":20480,"leader":10276657743932975437,"raftIndex":4,"raftTerm":2,"raftAppliedIndex":4,"dbSizeInUse
":16384,"storageVersion":"3.6.0"}}] |
Beta Was this translation helpful? Give feedback.
Hi @kwohlfahrt - Thanks for your question. For this use case you could wire up a health check based on
etcdctl
which can give some parseable json for the learner status, for example: