Cluster module
Layer 2. Core. Core The module is the membership record and the voter set.
Source: modules/cluster/ (ce module); the join and enrol implementations live in this repo’s modules/cluster/.
At a glance
Section titled “At a glance”| CLI | None |
| Subcommands | 6 |
| HTTP endpoints | see the route reference |
| Events emitted | see the event reference |
| Error codes | see the error code reference |
| Service classes | ClusterNodeService |
| Cross-module deps | app, doctor, health, network, node, storage |
Source layout
Section titled “Source layout”modules/cluster/├── drain.go├── errors.go├── leave.go├── network.go├── router.go├── service.go├── types.go├── voters.go└── commands/HTTP API
Section titled “HTTP API”Routes are listed in the generated route reference; request/response notes live in the API reference.
Errors
Section titled “Errors”Typed errors are catalogued in the error code reference with HTTP statuses and message templates.
Responsibilities
Section titled “Responsibilities”The cluster module owns node membership and the tokens that let new
nodes join. node owns the node record.
Service in service.go exposes Init, Join, Leave, Status,
and ForceLeader.
Join tokens are issued through /api/method/shc.cluster.token
(SHC modules/cluster/token_router.go). The joining node presents its
token to /api/join/node.enroll through Traefik on HTTPS 443.
The cluster CA row lives in cluster_ca_store.go. The node plane is
mesh0 (see two-tunnel mesh).
The enrol handler lives in SHC modules/cluster/enroll_handler.go, with
its public join route registered in enroll_rpc.go.
What the cluster module does not own: per-node daemon wiring
(that is node + shc.subsystems.daemon_manager),
rqlite (core/db/driver.go), or who is leader
(leader). This module is the membership record and the join token.