Restore from a backup file created with the new_backup function.
Before using this function the following list of requirements must be must be fulfilled:
FULL
privileges on the@thingsdb
scope.@thingsdb
scope. Use tasks() and task(..).del() to check and remove existing tasks.committed_change_id
and stored_change_id
for all nodes. This is not a requirement when using a single node.After running this function, all existing users and tokens will be overwritten, including the user performing the restore unless the take_access
argument will be set to true
. In both cases it is required to re-authenticate to ThingsDB after the restore is completed.
This function generates a change.
restore(filename, [options])
Argument | Type | Description |
---|---|---|
filename |
str | Tar file containing the backup, usually a file ending with .tar.gz . |
options |
thing (optional) | A thing with optional options. |
Option | Type | Description |
---|---|---|
take_access |
bool | When true , the users and tokens will not be restored and all associated tasks will be cleared. The user performing the restore will be granted full access to all scopes. Default is false . |
restore_tasks |
bool | When true , the tasks will be also be restored. If false or when take_access is set to true , all the tasks will be cleared. Default is false . |
The options take_access
and restore_tasks
cannot both be set to true
.
Returns nil
when successful.
Restore from a backup file
restore('/tmp/backup.tar.gz', {
take_access: true,
restore_tasks: false,
});
Return value in JSON format
null