restoreSettings

Syntax

restoreSettings(fileName, [overwrite=false], [serverVersion])

Details

Restore settings on users, permissions, and function views with files backed up with backupSettings to the current cluster.

This function can only be executed by an administrator on the controller. It can be used with backupSettings to back up and restore user settings when migrating databases.

Parameters

fileName is a STRING scalar specifying the backup file path. It can be an absolute path or relative path to <HomeDir>.

overwrite (optional) is a Boolean scalar indicating whether to overwrite the current settings with the backup setting files.

  • false (default): Not to overwrite the current settings. Only new users (along with permissions) and function views are added.

  • true: Delete current settings and overwrite with the backup files.

serverVersion (optional) is a STRING scalar specifying the DolphinDB Server version that generated the backup file. For backup files generated by backupSettings in 2.00.16.x or 2.00.17.x, specify "200.16" or "200.17" respectively when restoring in a later version; otherwise, restoreSettings may report Unknown entry type [5875] from acl backup file. For backup files generated by other versions, this parameter is not required; if specified, any string scalar is allowed.

Returns

A vector containing all restored user names and function views.

Examples

For a cluster with user A and B, restore permission settings on user A and C.

When overwrite=false, add user C and its permission to the cluster:

restoreSettings(fileName="/home/ddb/backup/permission.back", overwrite=false)

When overwrite=true, overwrite the user settings in the cluster:

restoreSettings(fileName="/home/ddb/backup/permission.back", overwrite=true)

For a backup file generated in 2.00.16.x, specify serverVersion when restoring it in a later version:

restoreSettings(fileName="/home/ddb/backup/permission.back", serverVersion="200.16")

Related function: backupSettings