Global registration gives a process a cluster-wide alias so clients can discover the same server regardless of node. It extends the ordinary client-server pattern—find a PID, then send a message—into a multinode system. For a distributed to-do cache, one process can own each list, such as {:todo_list, "bob"}. section 12.1.3 section 12.2.2
Global registration behaves like a cluster-aware process registry:
- Register an arbitrary term as an alias with :global.register_name/2; a successful registration returns :yes. section 12.1.3
- Resolve the alias from any connected node with :global.whereis_name/1. section 12.1.3 section 12.2.2
- Reject competing registrations for an existing alias, preserving one registered process per name unless the process crashes. section 12.1.3 section 12.2.2
- Coordinate registration with a cluster-wide lock, an alias check, notifications to all nodes, and inter-node messages; this creates coordination chatter. section 12.1.3
Registering distributed to-do servers
Name a GenServer with {:global, {Todo.Server, name}} and resolve it through :global.whereis_name/1. Replacing a local Registry registration with this global name lets Todo.Cache discover or start the same list server across the cluster. section 12.2.2
iex(node1@localhost)10> :global.register_name({:todo_list, "bob"}, self())
:yes
Inspect a successful registration, then compare it with the failed duplicate registration and remote lookup. section 12.1.3
