Leader address/location in Raft
Asked Answered
B

1

8

This may be a very simple question but I've not been able to find a good answer to this yet. Maybe someone can help me.

Once a leader is elected -

  1. The clients will send all requests ONLY to the leader. Is this correct?
  2. Given that the location (for all practical purposes the IP address) of the leader is dynamic, how will the client know this IP address in a cluster?
Beaded answered 10/8, 2014 at 15:18 Comment(0)
M
8

The client attempts to submit requests to any host in the cluster. If the client guesses wrong the server either forwards the request to the leader or returns an error with the address of who it thinks is the leader.

The first method (forwarding to the leader) is a better experience for the client. Be sure to limit the number of forwarding hops and timeout on the client.

The second method (error with leader address) is much easier to implement. Since the leader is typically long-lived except during troubled times, it usually only takes one retry to get the request to the leader.

Mediacy answered 12/8, 2014 at 15:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.