forked from lei.chen/myxce
docs(ha): use generated cleanup.sh in clean restart; clarify what it preserves
cleanup.sh is generated by deploy-ha.sh and already does the right thing:
keeps ctrl-1/conf/* and all certs, wipes ctrl-{2..N}/conf, all data/, and logs.
Update skill and CLAUDE.md to use it as the primary clean-restart command
instead of manual rm loops.
This commit is contained in:
parent
484b110009
commit
78b7942bbe
2 changed files with 31 additions and 13 deletions
|
|
@ -113,21 +113,36 @@ RAFT[p0] term=2 event=became_leader
|
|||
|
||||
## Clean restart
|
||||
|
||||
To wipe state and redeploy from scratch:
|
||||
Stop all instances, clean up state, and restart without redeploying:
|
||||
|
||||
```bash
|
||||
# 1. Stop running controllers
|
||||
kill -9 $(pgrep xce_controller) 2>/dev/null || true
|
||||
for i in 1 2 3; do
|
||||
rm -rf "$TOP/ctrl-$i/data/"*
|
||||
rm -f "$TOP/logs/ctrl-$i.log"
|
||||
done
|
||||
# Then re-run steps 3–5
|
||||
|
||||
# 2. Run the generated cleanup script
|
||||
# Keeps: ctrl-1/conf/* (primary config + current pointer), all certs
|
||||
# Wipes: ctrl-{1..N}/data/*, ctrl-{2..N}/conf/*, logs/*.log
|
||||
bash "$TOP/scripts/cleanup.sh"
|
||||
|
||||
# 3. Restart all nodes
|
||||
VERBOSE=-vvv "$TOP/scripts/start.sh" ctrl-1 &
|
||||
sleep 0.5
|
||||
VERBOSE=-vvv "$TOP/scripts/start.sh" ctrl-2 &
|
||||
sleep 0.5
|
||||
VERBOSE=-vvv "$TOP/scripts/start.sh" ctrl-3 &
|
||||
```
|
||||
|
||||
Or use the generated cleanup script (preserves primary config but wipes data/logs):
|
||||
```bash
|
||||
bash "$TOP/scripts/cleanup.sh"
|
||||
```
|
||||
**What cleanup.sh preserves:**
|
||||
- `ctrl-1/certs/` — TLS cert and key
|
||||
- `ctrl-1/conf/cluster.bin.*` + `conf/current` — primary config (standbys re-receive via push)
|
||||
- `ctrl-{2,3}/certs/` — TLS cert and key
|
||||
|
||||
**What cleanup.sh removes:**
|
||||
- All `data/` dirs (WAL, snapshots, `ha-term.bin`) — forces fresh election next start
|
||||
- `ctrl-{2,3}/conf/` — standbys rebuild config from primary's `OPCode_replConfigPush`
|
||||
- All `logs/*.log` — clean log slate
|
||||
|
||||
If you need a full redeploy (different peers or new binary), run steps 3–5 instead.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
|
|
|||
|
|
@ -97,11 +97,14 @@ grep -i "CTRL_PRIMARY\|Config committed" /tmp/xce-deploy/logs/ctrl-1.log | grep
|
|||
find /tmp/xce-deploy/ctrl-2/conf /tmp/xce-deploy/ctrl-3/conf -type f
|
||||
```
|
||||
|
||||
**Clean restart:**
|
||||
**Clean restart** (keeps ctrl-1 config + all certs, wipes data/standby-conf/logs):
|
||||
```bash
|
||||
kill -9 $(pgrep xce_controller) 2>/dev/null || true
|
||||
for i in 1 2 3; do rm -rf /tmp/xce-deploy/ctrl-$i/data/* /tmp/xce-deploy/logs/ctrl-$i.log; done
|
||||
# Then redeploy
|
||||
bash /tmp/xce-deploy/scripts/cleanup.sh
|
||||
# Then restart nodes (no redeploy needed)
|
||||
VERBOSE=-vvv /tmp/xce-deploy/scripts/start.sh ctrl-1 &
|
||||
sleep 0.5; VERBOSE=-vvv /tmp/xce-deploy/scripts/start.sh ctrl-2 &
|
||||
sleep 0.5; VERBOSE=-vvv /tmp/xce-deploy/scripts/start.sh ctrl-3 &
|
||||
```
|
||||
|
||||
See `.claude/skills/xce-deploy-ha/SKILL.md` for full troubleshooting reference.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue