Helios v0.1.0 Helios.Registry.Distribution.StaticQuorumRing View Source
A quorum is the minimum number of nodes that a distributed cluster has to obtain in order to be allowed to perform an operation. This can be used to enforce consistent operation in a distributed system.
Quorum size
You must configure this distribution strategy and specify its minimum quorum size:
config :my_app, MyApp.Endpoint,
registry:[
distribution_strategy: {
Helios.Registry.Distribution.StaticQuorumRing,
:init,
[5] # default static quorum size is 2
}
]
It defines the minimum number of nodes that must be connected in the cluster to allow process registration and distribution.
If there are fewer nodes currently available than the quorum size, any calls
to Helios.Registry.register_name/6
will return {:error, :no_node_available}
until enough nodes have started.
You can configure the :kernel
application to wait for cluster formation
before starting your application during node start up. The
sync_nodes_optional
configuration specifies which nodes to attempt to
connect to within the sync_nodes_timeout
window, defined in milliseconds,
before continuing with startup. There is also a sync_nodes_mandatory
setting
which can be used to enforce all nodes are connected within the timeout window
or else the node terminates.
config :kernel,
sync_nodes_optional: [:"node1@192.168.1.1", :"node2@192.168.1.2"],
sync_nodes_timeout: 60_000
The sync_nodes_timeout
can be configured as :infinity
to wait indefinitely
for all nodes to connect. All involved nodes must have the same value for
sync_nodes_timeout
.
Example
In a 9 node cluster you would configure the :static_quorum_size
as 5. During
a network split of 4 and 5 nodes, processes on the side with 5 nodes
will continue running, whereas processes on the other 4 nodes will be stopped.
Be aware that in the running 5 node cluster, no more failures can be handled because the remaining cluster size would be less than the required 5 node minimum. All running processes would be stopped in the case of another single node failure.
Link to this section Summary
Functions
Adds a node to the state of the current distribution strategy
Adds a node to the state of the current distribution strategy, and give it a specific weighting relative to other nodes
Adds a list of nodes to the state of the current distribution strategy. The node list can be composed of both node names (atoms) or tuples containing a node name and a weight for that node
Maps a key to a specific node via the current distribution strategy
Removes a node from the state of the current distribution strategy
Link to this section Functions
Adds a node to the state of the current distribution strategy.
Callback implementation for Helios.Registry.Distribution.Strategy.add_node/2
.
Adds a node to the state of the current distribution strategy, and give it a specific weighting relative to other nodes.
Callback implementation for Helios.Registry.Distribution.Strategy.add_node/3
.
Adds a list of nodes to the state of the current distribution strategy. The node list can be composed of both node names (atoms) or tuples containing a node name and a weight for that node.
Callback implementation for Helios.Registry.Distribution.Strategy.add_nodes/2
.
Maps a key to a specific node via the current distribution strategy.
If the available nodes in the cluster are fewer than the minimum node count it returns :undefined
.
Removes a node from the state of the current distribution strategy.
Callback implementation for Helios.Registry.Distribution.Strategy.remove_node/2
.