ExFdbmonitor.MgmtServer (ex_fdbmonitor v0.2.1)

View Source

A DGenServer that serializes actions across all nodes.

Nodes submit fdbcli commands via exec/1. The DGenServer processes them one at a time, ensuring commands from different nodes don't interleave on a cluster that is still being configured.

Summary

Functions

Returns a specification to start this module under a supervisor.

Exclude all FDB processes belonging to node_name from the cluster.

Execute fdbcli_args through the serialized server.

Look up the machine_id for a given node name.

Include all FDB processes belonging to node_name back into the cluster.

Register a mapping from machine_id to node_name in the server state.

Gracefully remove nodes_to_exclude from the cluster.

Declare the desired redundancy mode and configure when ready.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

exclude(node_name)

Exclude all FDB processes belonging to node_name from the cluster.

Raises if the node has no registered machine_id.

exec(fdbcli_args)

Execute fdbcli_args through the serialized server.

get_machine_id(node_name)

Look up the machine_id for a given node name.

include(node_name)

Include all FDB processes belonging to node_name back into the cluster.

Returns {:error, {:unknown_node, node_name}} if the node has no registered machine_id.

register_node(machine_id, node_name)

Register a mapping from machine_id to node_name in the server state.

scale_down(nodes_to_exclude)

Gracefully remove nodes_to_exclude from the cluster.

Automatically determines the appropriate redundancy mode for the surviving nodes and downgrades if necessary. Executes under the DGenServer lock:

  1. configure <mode> (only if downgrade needed)
  2. Set coordinators to surviving nodes
  3. exclude each departing node (blocks until data moved)

The caller is responsible for stopping workers on the removed nodes after this call returns.

scale_up(target_mode, nodes_to_include)

Declare the desired redundancy mode and configure when ready.

When target_mode is non-nil it is stored as the redundancy ceiling. When target_mode is nil the previously stored mode is used (also nil is fine — the call becomes a no-op).

nodes_to_include is a list of node names to include back into FDB before configuring (e.g. after a previous exclude).

If enough nodes are registered (@min_nodes), acquires the lock and runs includecoordinators autoconfigure <mode>. Calls before the threshold is met are no-ops.

start_link(arg)