Skip to content
Rowsafe
Docs

How Redis and Valkey backups work

Snapshots and every change over Redis's own replication, restores to any second, and what Rowsafe needs on your server.

The agent gets snapshots and every change from your server the way a replica does, encrypts them on your server and uploads them to your bucket. Nothing passes through Rowsafe's service. Valkey works exactly like Redis here.

Backups

Every backup is a full snapshot (an RDB file). The agent asks for it like a new replica does (as redis-cli --rdb does): Redis forks, writes it and sends it over the connection. The agent never reads Redis's files, so it works the same on a server or across Docker containers. The snapshot is encrypted on your server, then uploaded.

Every change, as it happens

After the snapshot, the agent stays connected as a replica that never serves anything. It stamps each change with its arrival time, cuts the stream into pieces about every minute, encrypts and uploads them. Your bucket is about a minute behind.

Redis lists the agent in INFO replication as ip=rowsafe-agent; Rowsafe leaves it out of its replica counts.

After a short break (restart, network blip), Redis resumes from its replication backlog (repl-backlog-size, 1 MB by default). A longer break forces a new snapshot: it becomes a new backup, and the gap before it can't be restored to a second. If that happens often, Pulse offers a bigger backlog.

Restoring to a second

A restore (Proof, a Rewind copy) loads the newest snapshot before your moment into a temporary server of the same engine and version (your server's own binary, or in Docker the agent image's), then replays changes to that second. Precise to about a second. Keys that have expired by then are gone, as they would be on your server.

Marks

A Mark records the exact stream position (replication id and offset). Restoring to it replays exactly to that point.

When Rowsafe can't follow the server

Rowsafe doesn't attach as a replica when:

  • SYNC/PSYNC are renamed or not allowed for its user;
  • the server uses min-replicas-to-write (Rowsafe would count as a replica and weaken that guarantee).

Then backups are scheduled snapshots only (BGSAVE, read from Redis's data folder; in Docker, mount the data volume read-only into the agent). Restores go back to those snapshots, not any second. The dashboard shows the mode and why.

Temporary servers

Proof and Rewind copies run as a temporary redis-server (or valkey-server) on the same host, on a private Unix socket only the agent can open, no network port. The agent checks free disk and memory first and refuses with a plain message if short. Memory is capped, so production keeps its memory.

  • Proof loads the newest backup, checks each logical database (db0, db1...) has its key count from backup time, replays changes since and compares with production. Deleted after, pass or fail.
  • Rewind copies stay up while you use them. Compare reports, per logical database, keys only in the copy, keys that differ and keys added since (large databases are sampled; the result says how many). Bringing keys back uses DUMP and RESTORE with remaining TTL, and never overwrites an existing key unless you choose to.

Rewinding in place

Done through Redis itself, one logical database at a time:

  1. Restored keys load into an empty logical database.
  2. SWAPDB swaps it with the live one, instantly. Never a moment without data; no restart.
  3. The old keys are freed in the background (FLUSHDB ASYNC).

Before the first swap, a snapshot of the current server goes to your bucket and is kept 7 days for Undo. Writes to a logical database while it loads are replaced by the swap; restoring to a second still finds them.

Needs one empty logical database and free memory for one more copy of the largest one.

Encryption

Snapshots and change pieces are encrypted on your server with your repository passphrase, like MySQL and MariaDB. Key names and values never reach your bucket or Rowsafe in the clear.

Rowsafe's ACL user

The agent connects locally (127.0.0.1, or the Redis service in Docker) as ACL user rowsafe. The installer creates it with a random password kept on the server (agent-only) and persists it in Redis's ACL or config file. In Docker, rowsafe-agent redis login creates it once with an admin password that's never saved; Redis keeps it in an ACL file in its data volume.

CommandsFor
reading and inspecting the serverbackups, Proof, compare and Pulse
the replication handshakesnapshots, and following every change
DUMP, RESTOREbringing keys back, only when someone asks in the dashboard
SWAPDB, FLUSHDB, DELrewinding the whole server in place, only when someone asks (DEL only for its own marker key)
CONFIG GET, CONFIG SET, CONFIG REWRITEreading settings, Tuning and the fixes someone applies
MEMORY PURGE, CLIENT KILLthe fixes someone applies
BGSAVEscheduled snapshots, when Rowsafe can't follow the server
ACL SETUSER, ACL DELUSER, ACL LIST, REPLICAOFonly with --redis-standby: the standby's replication login, the users a standby gets, an old primary following the new one
ACL LIST, GETUSER, USERS, SETUSER, DELUSER, SAVEDatabases & users and the security check: listing users, and creating, changing and removing the ones someone asks for

The user sees nothing outside Redis.

Standbys, clones and moving in

  • Standby: a real replica on another server. Rowsafe's own link is named rowsafe-agent, so it's never counted or mistaken for a standby. After a promotion, Rowsafe starts a fresh snapshot of the new primary; restores to earlier moments use the old server's history in the same bucket.
  • Clone: restored privately like a Rewind copy, then copied key by key (DUMP/RESTORE, with TTLs) into its own server.
  • Moving in: copies keys from the source in batches, or follows it as a replica where allowed.

Standby and clone servers are either empty servers root handed to Rowsafe, or new ones root's helper creates (rowsafe-redis@PORT, as redis, ports 6390 to 6399) if root allowed --redis-standby or --redis-clones at install. The helper only gets the SHA-256 of Rowsafe's password there.

Find the moment and safe copies

Find the moment reads the change pieces on your server and matches keys against your patterns; only patterns, counts and times reach Rowsafe. A safe copy is a temporary server, masked or emptied to its structure, opened over TLS to addresses you allow.

What never leaves the server

Key names and values are your data:

  • Pulse and the slow log: command names only (HGETALL), never arguments.
  • Recommendations: only key-name patterns covering many keys, with id-like parts replaced (session:*, user:*:cart). Command stats by name only.
  • Logs: client ports and quoted text removed on the server; crash reports stay there.
  • Passwords Rowsafe makes for your users are encrypted for your browser only, shown once.
  • Settings: requirepass and masterauth are never read.

Changes to the server's own files

  • Config file: changed only if root allowed sudo rowsafe-allow tuning. Root's helper writes Tuning's settings, keeps a copy, and restores old lines on undo. Otherwise changes persist via CONFIG REWRITE when Redis can write its config, or last until restart; the result says which.
  • Packages: updates and upgrades only where root allowed updates, from the server's own package sources.
Edit on GitHub