After a brief network interruption, my 3 node Consul cluster is down. The logs show a leader election happening, a node getting elected, but then an error about a peer having a newer term or no leader present.
Here are the logs from one of the servers, they are similar on each one.
Nov 18 16:15:12 n1 consul[2869524]: 2022-11-18T16:15:12.124Z [WARN] agent.server.raft: heartbeat timeout reached, starting election: last-leader-addr=192.168.2.102:8300 last-leader-id=fc373d0b-3aed
-44d4-ca0a-fe7f12d0118b
Nov 18 16:15:12 n1 consul[2869524]: 2022-11-18T16:15:12.124Z [INFO] agent.server.raft: entering candidate state: node="Node at 192.168.2.101:8300 [Candidate]" term=11024
Nov 18 16:15:12 n1 consul[2869524]: 2022-11-18T16:15:12.599Z [INFO] agent.server.raft: duplicate requestVote for same term: term=11024
Nov 18 16:15:12 n1 consul[2869524]: 2022-11-18T16:15:12.749Z [WARN] agent.server.raft: rejecting vote request since node is not a voter: from=192.168.2.30:8300
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.692Z [WARN] agent.server.raft: Election timeout reached, restarting election
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.692Z [INFO] agent.server.raft: entering candidate state: node="Node at 192.168.2.101:8300 [Candidate]" term=11025
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.816Z [WARN] agent.server.raft: rejecting vote request since node is not a voter: from=192.168.2.30:8300
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.916Z [INFO] agent.server.raft: election won: tally=2
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.916Z [INFO] agent.server.raft: entering leader state: leader="Node at 192.168.2.101:8300 [Leader]"
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.916Z [INFO] agent.server.raft: added peer, starting replication: peer=fc373d0b-3aed-44d4-ca0a-fe7f12d0118b
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.916Z [INFO] agent.server.raft: added peer, starting replication: peer=fa4f7537-f206-1d53-a204-54fe44621258
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.917Z [INFO] agent.server: cluster leadership acquired
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.917Z [INFO] agent.server: New leader elected: payload=n1
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.917Z [INFO] agent.server.raft: pipelining replication: peer="{Voter fc373d0b-3aed-44d4-ca0a-fe7f12d0118b 192.168.2.102:8300}"
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.918Z [ERROR] agent.server.raft: peer has newer term, stopping replication: peer="{Nonvoter fa4f7537-f206-1d53-a204-54fe44621258 192.168.2.30:8
300}"
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.949Z [INFO] agent.server.raft: aborting pipeline replication: peer="{Voter fc373d0b-3aed-44d4-ca0a-fe7f12d0118b 192.168.2.102:8300}"
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.950Z [INFO] agent.server.raft: entering follower state: follower="Node at 192.168.2.101:8300 [Follower]" leader-address= leader-id=
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.950Z [ERROR] agent.server: failed to wait for barrier: error="node is not the leader"
Nov 18 16:15:13 n1 consul[2869524]: 2022-11-18T16:15:13.950Z [INFO] agent.server: cluster leadership lost
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.218Z [WARN] agent.server.raft: heartbeat timeout reached, starting election: last-leader-addr= last-leader-id=
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.218Z [INFO] agent.server.raft: entering candidate state: node="Node at 192.168.2.101:8300 [Candidate]" term=11026
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.399Z [INFO] agent.server.raft: election won: tally=2
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.399Z [INFO] agent.server.raft: entering leader state: leader="Node at 192.168.2.101:8300 [Leader]"
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.399Z [INFO] agent.server.raft: added peer, starting replication: peer=fc373d0b-3aed-44d4-ca0a-fe7f12d0118b
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.399Z [INFO] agent.server.raft: added peer, starting replication: peer=fa4f7537-f206-1d53-a204-54fe44621258
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.400Z [INFO] agent.server: cluster leadership acquired
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.400Z [INFO] agent.server: New leader elected: payload=n1
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.401Z [INFO] agent.server.raft: pipelining replication: peer="{Voter fc373d0b-3aed-44d4-ca0a-fe7f12d0118b 192.168.2.102:8300}"
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.401Z [ERROR] agent.server.raft: peer has newer term, stopping replication: peer="{Nonvoter fa4f7537-f206-1d53-a204-54fe44621258 192.168.2.30:8
300}"
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.444Z [INFO] agent.server.raft: entering follower state: follower="Node at 192.168.2.101:8300 [Follower]" leader-address= leader-id=
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.444Z [INFO] agent.server.raft: aborting pipeline replication: peer="{Voter fc373d0b-3aed-44d4-ca0a-fe7f12d0118b 192.168.2.102:8300}"
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.444Z [ERROR] agent.server: failed to wait for barrier: error="node is not the leader"
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.444Z [INFO] agent.server: cluster leadership lost
Nov 18 16:15:15 n1 consul[2869524]: 2022-11-18T16:15:15.447Z [WARN] agent.server.raft: rejecting vote request since node is not a voter: from=192.168.2.30:8300
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.561Z [WARN] agent.server.raft: heartbeat timeout reached, starting election: last-leader-addr= last-leader-id=
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.561Z [INFO] agent.server.raft: entering candidate state: node="Node at 192.168.2.101:8300 [Candidate]" term=11027
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.750Z [INFO] agent.server.raft: election won: tally=2
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.750Z [INFO] agent.server.raft: entering leader state: leader="Node at 192.168.2.101:8300 [Leader]"
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.750Z [INFO] agent.server.raft: added peer, starting replication: peer=fc373d0b-3aed-44d4-ca0a-fe7f12d0118b
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.750Z [INFO] agent.server.raft: added peer, starting replication: peer=fa4f7537-f206-1d53-a204-54fe44621258
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.750Z [INFO] agent.server: cluster leadership acquired
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.750Z [INFO] agent.server: New leader elected: payload=n1
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.751Z [INFO] agent.server.raft: pipelining replication: peer="{Voter fc373d0b-3aed-44d4-ca0a-fe7f12d0118b 192.168.2.102:8300}"
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.751Z [ERROR] agent.server.raft: peer has newer term, stopping replication: peer="{Nonvoter fa4f7537-f206-1d53-a204-54fe44621258 192.168.2.30:8
300}"
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.839Z [INFO] agent.server.raft: entering follower state: follower="Node at 192.168.2.101:8300 [Follower]" leader-address= leader-id=
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.839Z [INFO] agent.server.raft: aborting pipeline replication: peer="{Voter fc373d0b-3aed-44d4-ca0a-fe7f12d0118b 192.168.2.102:8300}"
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.839Z [ERROR] agent.server: failed to wait for barrier: error="node is not the leader"
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.839Z [INFO] agent.server: cluster leadership lost
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.842Z [WARN] agent: Deregistering service failed.: service=_nomad-task-0821da93-abd5-54a1-76cd-5789a445b09c-group-lldap-ldap-admin-web error="
rpc error making call: rpc error making call: node is not the leader"
Nov 18 16:15:16 n1 consul[2869524]: 2022-11-18T16:15:16.842Z [ERROR] agent.anti_entropy: failed to sync remote state: error="rpc error making call: rpc error making call: node is not the leader"
Nov 18 16:15:17 n1 consul[2869524]: 2022-11-18T16:15:17.002Z [WARN] agent.server.raft: rejecting vote request since node is not a voter: from=192.168.2.30:8300
Nov 18 16:15:18 n1 consul[2869524]: 2022-11-18T16:15:18.447Z [WARN] agent.server.raft: rejecting vote request since node is not a voter: from=192.168.2.30:8300
Nov 18 16:15:18 n1 consul[2869524]: 2022-11-18T16:15:18.514Z [INFO] agent.server: New leader elected: payload=n2
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.127Z [WARN] agent.server.raft: heartbeat timeout reached, starting election: last-leader-addr=192.168.2.102:8300 last-leader-id=fc373d0b-3aed
-44d4-ca0a-fe7f12d0118b
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.127Z [INFO] agent.server.raft: entering candidate state: node="Node at 192.168.2.101:8300 [Candidate]" term=11029
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.270Z [WARN] agent.server.raft: rejecting vote request since node is not a voter: from=192.168.2.30:8300
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.444Z [INFO] agent.server.raft: election won: tally=2
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.444Z [INFO] agent.server.raft: entering leader state: leader="Node at 192.168.2.101:8300 [Leader]"
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.444Z [INFO] agent.server.raft: added peer, starting replication: peer=fc373d0b-3aed-44d4-ca0a-fe7f12d0118b
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.444Z [INFO] agent.server.raft: added peer, starting replication: peer=fa4f7537-f206-1d53-a204-54fe44621258
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.446Z [INFO] agent.server: cluster leadership acquired
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.446Z [INFO] agent.server: New leader elected: payload=n1
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.446Z [INFO] agent.server.raft: pipelining replication: peer="{Voter fc373d0b-3aed-44d4-ca0a-fe7f12d0118b 192.168.2.102:8300}"
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.447Z [ERROR] agent.server.raft: peer has newer term, stopping replication: peer="{Nonvoter fa4f7537-f206-1d53-a204-54fe44621258 192.168.2.30:8
300}"
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.602Z [INFO] agent.server.raft: entering follower state: follower="Node at 192.168.2.101:8300 [Follower]" leader-address= leader-id=
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.603Z [INFO] agent.server.raft: aborting pipeline replication: peer="{Voter fc373d0b-3aed-44d4-ca0a-fe7f12d0118b 192.168.2.102:8300}"
Nov 18 16:15:20 n1 consul[2869524]: 2022-11-18T16:15:20.603Z [ERROR] agent.server: failed to wait for barrier: error="leadership lost while committing log"
It’s also interesting that one of the nodes was made a backup voter. Perhaps that was autopilot’s doing.