docs(ha-config-bootstrap): only primary needs initial config — standbys get it via replication
This commit is contained in:
parent
f465af0c0c
commit
bc2aaff089
1 changed files with 20 additions and 17 deletions
|
|
@ -84,35 +84,38 @@ done
|
||||||
> All nodes share the same self-signed cert so they mutually trust each other.
|
> All nodes share the same self-signed cert so they mutually trust each other.
|
||||||
> In production each node has its own cert signed by a shared CA.
|
> In production each node has its own cert signed by a shared CA.
|
||||||
|
|
||||||
### Initial Cluster Configuration (required)
|
### Initial Cluster Configuration (primary node only)
|
||||||
|
|
||||||
The controller looks for its cluster config at:
|
Thanks to config replication, **only the primary node (ctrl-a) needs the initial
|
||||||
|
config file.** Nodes B and C start with `config_tag=0`, defer the config fetch,
|
||||||
|
yield the election to the primary, and automatically receive the config via
|
||||||
|
`push_config_to_standbys()` after catch-up.
|
||||||
|
|
||||||
|
The controller looks for config at:
|
||||||
```
|
```
|
||||||
{workdir}/{myname}/conf/current ← pointer file (contains the config filename)
|
{workdir}/{myname}/conf/current ← pointer file
|
||||||
{workdir}/{myname}/conf/cluster.bin.<hex_tag> ← actual capnp config blob
|
{workdir}/{myname}/conf/cluster.bin.<hex_tag> ← capnp config blob
|
||||||
```
|
```
|
||||||
|
|
||||||
The `<hex_tag>` is the first 8 bytes of the SHA-256 of the config blob, as 16 hex digits.
|
The `<hex_tag>` is the first 16 hex chars of the SHA-256 of the config blob
|
||||||
|
(= first 8 bytes).
|
||||||
|
|
||||||
**Steps (using your existing config file):**
|
**Install config on Node A only:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Compute the config tag from your config blob
|
|
||||||
TAG=$(sha256sum /path/to/your_config.bin | awk '{print $1}' | cut -c1-16)
|
TAG=$(sha256sum /path/to/your_config.bin | awk '{print $1}' | cut -c1-16)
|
||||||
echo "Config tag: $TAG"
|
echo "Config tag: $TAG"
|
||||||
|
|
||||||
# 2. Install config into each node's workdir
|
CONF_DIR="/tmp/xce-a/ctrl-a/conf"
|
||||||
for node in a b c; do
|
mkdir -p "$CONF_DIR"
|
||||||
NODE_NAME="ctrl-${node}"
|
cp /path/to/your_config.bin "${CONF_DIR}/cluster.bin.${TAG}"
|
||||||
CONF_DIR="/tmp/xce-${node}/${NODE_NAME}/conf"
|
printf "cluster.bin.${TAG}" > "${CONF_DIR}/current"
|
||||||
mkdir -p "$CONF_DIR"
|
|
||||||
cp /path/to/your_config.bin "${CONF_DIR}/cluster.bin.${TAG}"
|
|
||||||
printf "cluster.bin.${TAG}" > "${CONF_DIR}/current"
|
|
||||||
done
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> The `current` file must contain exactly the filename (no trailing newline,
|
> `printf` (not `echo`) avoids a trailing newline that would corrupt the pointer.
|
||||||
> no path separators). `printf` (not `echo`) avoids the trailing newline.
|
>
|
||||||
|
> Nodes B and C need **no** config pre-installed — they will receive it from
|
||||||
|
> the primary automatically after election completes.
|
||||||
|
|
||||||
### Start the 3-node cluster (3 terminals)
|
### Start the 3-node cluster (3 terminals)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue