Backup and restore
kovadump talks to a server that is already running. It writes a Kova file, and it can read SQL and MongoDB dumps back in.
kovadump is installed next to kova. Backup and restore use the MongoDB port. Restore writes through ordinary insert, create, and createIndexes, so the log, the indexes, and a replica set see normal writes.
kovadump backup --db shop shop.kdmp kovadump restore --db shop shop.kdmp kovadump restore --port 27019 --db shop pg.sql kovadump restore --yes --table orders --table customers --db db db.kdmp
Host defaults to 127.0.0.1 and port to 27018.
Flags
| Flag | Meaning |
|---|---|
--host | Defaults to 127.0.0.1. |
--port | Defaults to 27018. |
--db | The database to read or write. |
--user --password | Both set, or both omitted. Omit them while security is off. |
--table | Restore only these names. Repeat the flag, or separate names with commas. |
--yes | Replace a collection that is already there without asking. A non-interactive run passes --yes. |
Backup writes one database: collections (documents and indexes, except the generated _id_ index), autoincrement counters, and views. Restore drops a view that reads a collection being replaced, drops and recreates each collection in the dump, then recreates the views. A collection the dump does not name is left in place. When a collection is already there, restore asks before replacing it.
What restore reads
| Input | What lands in Kova |
|---|---|
| Kova dump | Magic KOVADMP1, then BSON documents whose kind is collection, document, index, counter, or view. A counter record is one autoincrement field and its last. |
pg_dump plain SQL | CREATE TABLE, text-format COPY … FROM stdin ended by \., and INSERT. The schema is dropped, so public.emp becomes emp. A primary key or UNIQUE becomes a unique index. A foreign key becomes an index on the referencing columns. A serial, bigserial, smallserial, AUTO_INCREMENT, identity, or DEFAULT nextval column becomes an autoincrement field when the primary key does not already cover it. setval sets last. SET, OWNER, and function bodies are skipped. Binary COPY is refused. Custom-format archives are not read. |
mysqldump SQL | Backtick identifiers, CREATE TABLE, and extended INSERT. LOCK TABLES is skipped. |
mongodump directory or archive | A directory is <db>/<collection>.bson plus an optional metadata file. The dump root uses the subdirectory named by --db, or the only database subdirectory. An archive starts with magic 0x8199e26d. timeseries is refused. Names starting with system. are skipped. |
setval with the third argument true stores that number as last. False stores one below it, so the next insert uses the number in the call. A dump with neither setval nor a counter row sets last to the highest value already stored. The integers in the file stay in the field. See Autoincrement.
Router, shard, or one process
Point the dump at the address you want to read. Against a router, the file has the whole database when every shard answers. If a shard is down, the dump fails and no partial file is written. Against one shard, the file has that piece. A shard with no replica is silent while its process is down. The other shards still answer their own finds. Restarting that process on the same data directory brings the piece back.