Skip to main content

Backup and restore

There are two kinds of backup, and they are not the same. The configuration export is a JSON file you make in the Console. The full backup is a database dump plus configuration and secrets. Use the full backup to protect a plant. Use the configuration export to copy settings to another Console.

Settings, Backup, with Export JSON, Import JSON and the import mode
Settings, Backup, with Export JSON, Import JSON and the import mode
Keep the master key with the backup

Passwords, tokens and private keys are sealed with the master key (MI_MASTER_KEY, in Lite the file secrets/master.key). A backup without the matching key restores, but every stored credential is unreadable and you must enter them again. Keep the key with your backups, in a safe place. Protect the backup file itself too, because a Lite backup contains the key.

Which one do I need?​

I want toUse
Protect a Lite plant against disk loss or a bad upgrademii backup (full)
Go back after an upgrademii rollback
Move devices, rules and uplinks to another ConsoleConfiguration export and import
Move from Lite to an Enterprise ConsoleConfiguration export and import
Protect a plant stackVolume backups (see below)

Full backup of mii Lite​

What is included​

PartIn the backup
manifest.jsonYes (version and checksums)
db.dumpYes: the whole PostgreSQL database made with pg_dump -Fc. It includes the Console data and the history, because the Lite historian is in the same database
config/Yes (mii.env)
secrets/Yes, including master.key
data/ot/Yes (OT runtime data)
data/stream/Yes (rules engine data)
data/buffer/No. It is transient
logs/No

Make a backup​

A backup works while the service is running. It writes mii-backup-<version>-<timestamp>.zip to the backups folder of the data directory.

& "C:\Program Files\MakeIntelligent\mii.exe" backup
# or to a chosen file
& "C:\Program Files\MakeIntelligent\mii.exe" backup --out D:\safe\plant-before-change.zip

Default folder: C:\ProgramData\MakeIntelligent\backups\.

The output ends with Backup written: <path>.

Restore​

The service must be stopped. A restore replaces the database and the files.

  1. Stop the service: mii stop.
  2. Run mii restore <file>. It asks you to type RESTORE. Use --yes to skip the question in a script.
  3. The current data is kept next to it as *.pre-restore-<timestamp> (for example the database folder gets a pg.pre-restore-<time> copy). Delete it when you are sure.
  4. Start the service: mii start.

Rules:

  • A backup from a newer version than the installed one is refused.
  • A backup whose version cannot be compared is refused unless you add --allow-unknown-version.
  • If a restore is interrupted, the service refuses to start ("refusing to start") until you repeat the restore.
  • With an external PostgreSQL (MI_LITE_PG_URL, for development only), the restore runs pg_restore --clean over that database.

Automatic backup before an upgrade​

Every time the version changes, mii makes a backup named auto-preupgrade-<old>-to-<new>-<timestamp>.zip before it migrates the database. If the backup fails, the start is aborted and nothing is changed. The three most recent upgrade pairs keep their automatic backup. Manual backups are never deleted by mii.

Rollback​

mii rollback (service stopped) restores the pre-upgrade backup and runs the previous version again. See Upgrade.

Schedule it​

mii has no built-in schedule. Use the operating system:

schtasks /Create /SC DAILY /ST 02:00 /TN "mii backup" /RU SYSTEM /TR "\"C:\Program Files\MakeIntelligent\mii.exe\" backup --out D:\safe\mii-daily.zip"
# /etc/cron.d/mii-backup (Linux)
0 2 * * * root /opt/makeintelligent/mii backup --out /srv/backups/mii-$(date +\%F).zip

A fixed --out name overwrites the file of the day before; use a date in the name and prune old files yourself. Copy the files off the computer.

Configuration export and import (all editions)​

Open Settings → Backup. The section is called Configuration backup. It needs the permission to export or import configuration, and is hidden for users with limited access.

What it covers​

Devices, uplinks (Destinations), routes, rules, streams, sinks, alert webhooks and certificates. The bundle also includes the knowledge graph, the process model and the OEE settings. The ISA-95 model itself (enterprise, site, areas, equipment) is not in the bundle.

note

This is not a database backup. It does not hold history, alarms, users or the audit log. Use mii backup for that.

Export​

  1. Optionally tick Include secrets (needed to restore MQTT/Kafka passwords and private keys).
  2. Click Export JSON. A file downloads. The line Last export shows a count of what left the Console.

Without the tick, passwords, tokens and private keys are left out. With the tick, they are in the file: protect it like a password.

Import​

  1. Choose Import mode:
    • Merge (upsert by id): adds new items and updates items with the same id.
    • Replace (delete existing config first): deletes devices, Destinations, routes, rules, streams, sinks, alert webhooks and certificates first. You must confirm "Continue?".
  2. Click Import JSON and choose the file. Last import shows the result.

Details:

  • An import runs the licence checks. Limits of your licence still apply.
  • An import never turns on webhook delivery. Switch it on in Uplinks.
  • An import without secrets keeps the secrets already stored for the same device or uplink. On another Console they must be entered again.
  • Safe-write limits already on this Console are kept, and the result lists them.

API: GET /api/v2/config/export?secrets=1 and POST /api/v2/config/import with {"mode":"merge"|"replace","bundle":{…}}.

Plant stack (Docker Compose, k3s)​

The plant stack has no mii backup. Back up these four volumes:

VolumeContent
postgres-dataThe Console database (mi-db)
clickhouse-dataThe history (mi-tsdb)
mii-secretsPasswords, JWT secret and master key
siterun-buffer-dataThe buffer of the Site Runtime (only needed if you cannot lose the last hours)

For a consistent database backup, use pg_dump and check it:

docker compose -f compose.plant.yml exec mi-db pg_dump -U mii -Fc makeitintelligent > mii-$(date +%F).dump
pg_restore -l mii-$(date +%F).dump | head

Always back up mii-secrets together with the database. A database restored with a different master key cannot open the stored secrets.

Limits and good practice​

  • Test a restore on another computer at least once. A backup you never restored is a guess.
  • Make a manual backup before every change you cannot undo: a retention change, a Replace import, a licence swap.
  • Keep three copies, on two kinds of storage, one off site.
  • Store the master key separately from the backup if your policy requires it, but never lose it.
  • A full backup contains history. A year of data from many tags can be large, so check the free space of the backups folder.

Troubleshooting​

SymptomCauseFix
restore says the service is runningThe service must be stoppedmii stop, then restore
restore refuses the fileThe backup is from a newer version, or its version cannot be comparedInstall the same or a newer version, or use --allow-unknown-version if you are sure
Service will not start after an interrupted restoreThe restore did not finishRun the restore again
Credentials are blank after a restoreMaster key differsRestore the key from the backup (secrets/master.key), or enter credentials again
Import refused by licenceThe bundle exceeds your licence limitsSee Licensing
Webhooks do not fire after importDelivery is never turned on by an importSwitch it on in Uplinks