Backup and restore¶
Central has one state carrier — PostgreSQL. Which means the installation's entire backup is a regular dump of one database; neither the streamers' state directories nor the archive belong in it, and neither is needed to restore the control plane.
Take dumps¶
pg_dump -U optic optic > optic-$(date +%F).sql
The credentials are in DATABASE_URL from /etc/optic/secrets.env. Put it on a timer and move the copies off the machine: the dump is small (configuration and records, not media), so taking it even hourly costs nothing.
Save the /etc/optic/secrets.env file itself once, at installation time: it is not in the dump, and a restored installation will need the same passwords.
Restore¶
Restore procedure:
- Stop all central instances: run
systemctl stop opticon each control machine. - Recreate the database and load the dump. In this example, the
opticrole must own the database and have theCREATEDBprivilege:
psql -U optic -d postgres -c 'DROP DATABASE optic WITH (FORCE);' -c 'CREATE DATABASE optic OWNER optic;'
psql -U optic -d optic < optic-2026-07-21.sql
- Start central with
central.components.migrate: true:systemctl start optic. Wait until it is ready, then start the remaining instances.
Nothing else is needed: the streams, the registry and the settings came back with the dump, and the streamers — which kept broadcasting on their own all along — reconnect automatically, within the minute-long retry pause. If the dump turns out older than what the streamers have applied, they get an explicit signal from central and take its state as the truth — configuration version rollback does not disrupt the cluster.
Complete destruction of central — broadcasting never stops¶
This is the core guarantee of the Optic architecture: losing the entire central machine — disk, database, everything — does not interrupt broadcasting. Streamers operate autonomously, and playback continues while central is being restored.
- Install Optic on a new machine without entering the console.
- Return the saved
/etc/optic/secrets.env(or put the oldDATABASE_URLinto the new one, if the database was external and survived). - Restore the database from the dump as above, and start the service.
Streamers find the replacement central at the original address and reconnect: their keys were restored from the dump with the registry. The control plane has been restored, while broadcasting continued without interruption.
If there is no dump — the control plane is built anew: an empty central, streams created from scratch, and every orphaned streamer re-attached with a state reset and a fresh join token. Broadcasting continues in this scenario too — but the stream configuration has to be recreated by hand. One regular pg_dump spares you rebalancing the whole cluster.
What not to back up¶
- Streamer state directories — they identify individual machines; after a machine is lost, join its replacement again.
- The DVR archive — media on streamer disks; its protection depends on disks and replication, not a database dump.
- The metrics store — held in memory; history accumulates again.