{"id":20564521,"url":"https://github.com/tarantool/dump","last_synced_at":"2025-10-24T13:52:40.322Z","repository":{"id":46196085,"uuid":"94517569","full_name":"tarantool/dump","owner":"tarantool","description":"Logical backup and restore of a tarantool instance.","archived":false,"fork":false,"pushed_at":"2021-11-08T06:26:28.000Z","size":52,"stargazers_count":12,"open_issues_count":3,"forks_count":0,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-04-14T15:12:50.191Z","etag":null,"topics":["backup","dump","export","import","msgpack","restore","tarantool"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tarantool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-16T07:28:00.000Z","updated_at":"2025-04-06T09:26:15.000Z","dependencies_parsed_at":"2022-09-22T23:30:28.850Z","dependency_job_id":null,"html_url":"https://github.com/tarantool/dump","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fdump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fdump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fdump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fdump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tarantool","download_url":"https://codeload.github.com/tarantool/dump/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248904637,"owners_count":21180835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","dump","export","import","msgpack","restore","tarantool"],"created_at":"2024-11-16T04:27:30.313Z","updated_at":"2025-10-24T13:52:35.301Z","avatar_url":"https://github.com/tarantool.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://travis-ci.org/tarantool/dump\"\u003e\u003cimg src=\"https://travis-ci.org/tarantool/dump.png?branch=master\" align=\"right\"\u003e\u003c/a\u003e\u003cbr/\u003e\n\n# dump \u003cimg src=\"https://github.com/tarantool/dump/blob/master/docs/truck.png?raw=true\" align=\"right\"\u003e\n\nLogical backup and restore of a Tarantool instance.\n\n## Why you need a logical backup\n\nTarantool provides a physical backup with\n[box.backup](https://tarantool.org/en/doc/1.7/book/admin/backups.html#hot-backup-vinyl-memtx)\nmodule. But you may still want a logical one.\n\nHere's why:\n\n* A logical backup contains tuples, not files. By making a logical backup, you\n  ensure that the database server can read the contents of the database.\n  A logical backup sees the database through the same lense as your application.\n* If Tarantool binary file layout changes, you still can restore data from a\n  logical backup.\n* You could use a logical backup to export data into another database (although\n  we recommend using Tarantool's [MySQL](http://github.com/tarantool/mysql) or\n  [PostgreSQL](http://github.com/tarantool/pg) connectors for this).\n\n## How to use\n\nThis module takes each space in Tarantool and dumps it into a file in a specified directory.\nThis includes data for system spaces _space and _index, which are dumped first. The restore\nis performed in the opposite order, when files for restore are sorted according to their id \n(system spaces have id \u003c 512, so their data is naturally restored first). Restoring the system \nspaces first ensures that all *definitions* for user-defined spaces are already in place when a \nuser-defined space dump file is restored.\n\n### Preparation\n\nEnsure that the database is not being changed while dump or restore is in progress.\n\n### Execution\n\n```local status, error = require('dump').dump('/path/to/logical/backup')```\n\nThe path should not exist, or be an empty directory. It is created if it does\nnot exist. The command then dumps all space and index definitions, users, roles\nand privileges, and space data. Each space is dumped into a file in the path\nnamed `\u003cspace-id\u003e.dump`.\n\n```local status, error = require('dump').restore('/path/to/logical/backup')```\n\nPlease note that this module does not throw exceptions, and uses Lua conventions for\nerrors: check the return value explicitly to see if your dump or restore has succeeded.\n\nThis command restores a logical dump.\n\n### Advanced usage\n\nYou can use a filter function as an additional argument to dump and restore.\nA filter is a function that takes a space and a tuple and returns a tuple. \nThis function is called for each dumped/restored tuple. It can be used to overwrite\nwhat is written to the dump file or restored. If it returns nil the tuple is skipped.\n\nFor example, 'filter' option can be used to convert memtx spaces to vinyl as\nshown below:\n```\ndump.restore('dump', {\n    filter = function(space, tuple)\n        if space.id == box.schema.SPACE_ID then\n            return tuple:update{{'=', 4, 'vinyl'}}\n        else\n            return tuple\n        end\n    end\n})\n```\n\n### Details\n\nThe backup utility creates a file for each dumped space, using space id for file name. The dump skips spaces with id \u003c 512 (the system spaces), with the exception of tuples which contain metadata of user-defined spaces, to ensure smooth restore on an empty instance. If you want to restore data into an existing space, delete files with ids \u003c 512 from the dump directory and create the destination space manually with Lua during restore. Alternatively, you can keep all files with id \u003c 512, this will restore or space definitions, and your particular space file, and pass this to dump. For more intellectual filtering, use dump/restore filtering.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarantool%2Fdump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarantool%2Fdump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarantool%2Fdump/lists"}