Main Components Discovery Master Election Cluster State Publication
Slide 11
Zen
Zen to Zen2 Not pluggable
Slide 12
Slide 13
Why
https://www.elastic.co/guide/en/elasticsearch/resiliency/current/index.html
Repeated network partitions can cause cluster state updates to be lost (STATUS: DONE, v7.0.0) And more
Slide 14
How
https://github.com/elastic/elasticsearch-formal-models
TLA+ specification TLC model checking
Slide 15
https://github.com/elastic/elasticsearch-formal-models/blob/ master/cluster/isabelle/Preliminaries.thy text <open>It works correctly on finite and nonempty sets as follows:<close> theorem fixes S :: “Term set” assumes finite: “finite S” shows maxTerm_mem: “S <noteq> {} <Longrightarrow> maxTerm S <in> S” and maxTerm_max: “<And> t’. t’ <in> S <Longrightarrow> t’ <le> maxTerm S” proof presume “S <noteq> {}” with assms obtain t where t: “t <in> S” “<And> t’. t’ <in> S <Longrightarrow> t’ <le> t” proof (induct arbitrary: thesis) case empty then show ?case by simp …
Slide 16
Discovery
Where are master-eligible nodes? Is there a master already?
Master Election
Agree which node should be master Form a cluster
Slide 20
Slide 21
discovery.zen. minimum_master_nodes Trust users? Scaling up or down?
Slide 22
Three Node Cluster
Slide 23
discovery.zen.minimum_master_nodes: ~
Slide 24
discovery.zen.minimum_master_nodes: 2
Slide 25
discovery.zen.minimum_master_nodes: 2
Slide 26
discovery.zen.minimum_master_nodes: 2
Slide 27
discovery.zen.minimum_master_nodes: 2
Slide 28
discovery.zen.minimum_master_nodes: 2
Slide 29
discovery.zen.minimum_master_nodes: 2
Slide 30
cluster. initial_master_nodes List of node names for the very first election
Slide 31
OK
to set on multiple nodes as long as they are all consistent
Slide 32
Ignored
once node has joined a cluster even if restarted
Slide 33
Unnecessary
when joining new node to existing cluster
Slide 34
Upgrade 6 to 7
Full cluster restart: Set cluster.initial_master_nodes Rolling upgrade: cluster.initial_master_nodes not required
Slide 35
Demo Upgrade
6.7 → 7.0, 6.8 → 7.1+
Slide 36
Demo
Full Cluster Restart docker stop <ID> on all nodes docker start <ID> on all nodes
Slide 37
Cluster Scaling
Master-ineligible: as before Adding master-eligible: just do it Removing master-eligible: just do it As long as you remove less than half of them at once
Slide 38
Demo
Scale down to a single node POST /_cluster/voting_config_exclusions/elasticsearch1 POST /_cluster/voting_config_exclusions/elasticsearch2
“master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and [cluster.initial_master_nodes] is empty on this node: have discovered [ {elasticsearch1}{pSUJ60tSRWSrcWkRevLfyA}{_jIaabgyTQOHAOjcwUruIQ} {192.168.112.3}{192.168.112.3:9300} {…}, {elasticsearch3}{ngaTCze8QHSHydCXsttXyw}{mbIad-A4SLOJvP7Ava5dEw} {192.168.112.4}{192.168.112.4:9300} {…} ];
Slide 42
discovery will continue using [192.168.112.3:9300, 192.168.112.4:9300] from hosts providers and [ {elasticsearch2}{iANt64LESxqjJv8tHV5KKw}{K0bYEuQ2TnamsiOefTUXgQ} {192.168.112.2}{192.168.112.2:9300} {…} ] from last-known cluster state; node term 0, last-accepted version 0 in term 0”
Slide 43
Cluster State Publication
Agree on cluster state updates Broadcast updates to all nodes