Skip to content

fix(ns-ha): move HA rsync staging to tmpfs, sync every 10 minutes#1772

Draft
gsanchietti wants to merge 1 commit into
mainfrom
issue1771
Draft

fix(ns-ha): move HA rsync staging to tmpfs, sync every 10 minutes#1772
gsanchietti wants to merge 1 commit into
mainfrom
issue1771

Conversation

@gsanchietti

@gsanchietti gsanchietti commented Jul 7, 2026

Copy link
Copy Markdown
Member

Fixes #1771

Prevents HA config corruption (null bytes) on failover.

  • Move rsync staging dir from /usr/share/keepalived/rsync (overlayfs) to /tmp/ns-ha (tmpfs)
  • Reduce sync interval 60s → 600s
  • Fix sender mkdir so tmpfs staging dir is recreated each run (survives reboot)
  • uci-defaults migration for existing installs (both nodes)

Testing

Tested on a live 2-node cluster (primary 192.168.100.238, backup 192.168.100.239, VIP 192.168.100.240), configured via ns-ha-config per the ns-ha README.

  • Config applied: interval=600, sync_dir=/tmp/ns-ha, keepalived.conf vrrp interval 600 on both nodes
  • No legacy /usr/share/keepalived/rsync present anywhere
  • Sync completes: Last Sync Status: Successful, staging lands in /tmp/ns-ha (159 files in restore_list)
  • /tmp/ns-ha is on tmpfs; staged configs have zero null bytes (no corruption)
  • NOTIFY_SYNC restore copies staged files to real paths on backup (verified with a custom sync_list marker file)
  • Failover: stop primary → VIP + master move to backup; restart primary → reclaims master + VIP
  • Reboot backup → /tmp/ns-ha wiped by tmpfs → next sync recreates it successfully (validates the mkdir "$sync_dir" fix)

Comment thread packages/ns-api/files/ns.ha
Prevent HA config file corruption (null bytes) on slave failover
caused by concurrent rsync writes to the persistent overlayfs.

Move the rsync staging area from /usr/share/keepalived/rsync to
/tmp/ns-ha (tmpfs) and reduce the sync interval from 60s to 600s.
Fix the sender mkdir so the tmpfs staging dir is recreated on each
run, since tmpfs is emptied at reboot. Add a uci-defaults migration
that updates interval and sync_dir on both nodes for existing
installs and drops the legacy staging directory.

Refs #1771

Assisted-by: Claude Code:claude-opus-4-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HA: Corrupted config files with null bytes on slave failover

1 participant