GNU/Linux xterm-256color zsh 218 views

The cluster tries to elect the node with the greatest available id. Sometimes, when the cluster is degraded, the lowest id is chosen. See part 2

ZK version: 3.4.9-3+deb9u2

The final relation of restarts for 1/2/3 node: 68/764/804

Restart script:

i=1
while true
do sleep $((RANDOM % 3))
  is_leader=$(echo stat | nc localhost 2181 | grep 'Mode: leader')
  ! [ "$is_leader" ] && continue
  printf "\rrestarts: $i"
  i=$(($i + 1))
  sudo systemctl restart zookeeper.service
done