Peer set - The peer set is the set of all members participating in log replication. For Consul's purposes, all server nodes are in the peer set of the local datacenter.
~ Quote from Official docs
Why do we have following two APIs then? (one is enough?)
i. /status/peers
ii. /agent/members
Could you please shed light on the internal details?
Here is a comparison of /agent/members/
, status/peers/
and catalog/nodes
.
The possible difference in response is because each of the API end point get data from different sources.
/catalog/nodes
: The request recieved by any agent is redirected to the leader, and leader provides the response from catalog./agent/members/
: Agent receives the request and return member information obtained from gossip. This can be different from catalog
end point (as obvious from log replication mechanism (Consul uses Raft Prorocol) )./status/peers/
: This API return the nodes participating in 'log replication'./catalog/node
. But if there is a partition in the cluster, it is possible that, until the cluster recover, all members are not taking part in log replication. In this case /catalog/nodes/
and /status/peers/
can give different results.To understand this proper, you need to know the raft protocol properly. Reference.