asrestore utility restores backups created with asbackup. If the namespace on the cluster already contains existing records, a configurable write policy determines, which records take precedence - records in the namespace or records from the backup. The Write Policy section on the overview page has more details on this.
If the initial insertion of a record fails
asrestore will retry inserting the record 10 times. Between tries there is a 1 second pause and the error is written to the logs at the debug severity level. If a record is not written after 10 tries, the restore is aborted with the error message "Too many errors, giving up". The specific errors in which a retry is not effected are "record exists" (when the --unique option is used), "generation mismatch" (unless if the --no-generation option is used) and "invalid username or password".
When run with the
asrestore expects multiple
.asb backup files in the given directory. Alternatively,
asrestore read the complete backup from the given single file. If
- is specified as the file,
asrestore reads the backup from
stdin. This allows for pipelines:
cat backup.asb.gz | gunzip | asrestore --input-file - [...]
--help option of
asrestore gives an overview of all supported command line options.
$ asrestore --help
The most basic form of running
asrestore is to just specify the cluster to restore (
--host) and the local directory containing the backup files (
--directory). Suppose that we have a cluster that contains a node with IP address
22.214.171.124. To restore a backup from directory
backup_2015_08_24, we would issue the following command.
$ asrestore --host 126.96.36.199 --directory backup_2015_08_24
By default, the backup is restored to the namespace that it was taken from. The
--namespace option can be used to restore to a different namespace. Suppose that the above backup was taken from namespace
test and we would like to restore it to namespace
prod. We would then issue the following command.
$ asrestore --host 188.8.131.52 --directory backup_2015_08_24 --namespace test,prod
|127.0.0.1||The host that acts as the entry point to the cluster. Any of the cluster nodes can be specified. The remaining cluster nodes will be automatically discovered.|
|3000||Port to connect to.|
|-||User name with write permission. Mandatory if the server has security enabled.|
|-||Password to authenticate the given user. The first form passes the password on the command line. The second form prompts for the password.|
|INTERNAL||Set authentication mode when user and password are defined. Modes are (INTERNAL, EXTERNAL, EXTERNAL_INSECURE, PKI) and the default is INTERNAL. This mode must be set EXTERNAL when using LDAP.|
|20||The number of client threads to spawn for writing to the cluster. Higher numbers mean faster restores, which may, however, have a negative impact on server performance.|
|disabled||Indicates a TLS connection should be used.|
|10000||Timeout (ms) for Aerospike commands to write records, create indexes and create UDFs.|
|false||Use to connect to |
|10000||Socket timeout for write transactions in milliseconds. If this value is 0, it is set to total-timeout. If both are 0, there is no socket idle time limit.|
|0||Total socket timeout in milliseconds. If this value is 0 and |
|0||Maximum number of retries before aborting the current write transaction.|
|0||The amount of time to sleep between retries of write transactions.|
|Path to a trusted CA certificate file.|
|Path to a directory of trusted CA certificates.|
|The default TLS name used to authenticate each TLS socket connection. Note: this must also match the cluster name.|
|Set the TLS protocol selection criteria. This format is the same as Apache's SSLProtocol documented at https://httpd.apache.org/docs/current/mod/mod_ssl.html#sslprotocol . If not specified the asrestore will use '-all +TLSv1.2' if has support for TLSv1.2, otherwise it will be '-all +TLSv1'.|
|Set the TLS cipher selection criteria. The format is the same as Open_sSL's Cipher List Format documented at https://www.openssl.org/docs/manmaster/man1/ciphers.html .|
|Path to the key for mutual authentication (if Aerospike Cluster is supporting it).|
|Password to load protected tls-keyfile. It can be one of the following:|
1) Environment varaible: 'env:<VAR>'
2) File: 'file:<PATH>'
3) String: 'PASSWORD'
User will be prompted on command line if --tls-keyfile-password specified and no password is given.
|Path to the chain file for mutual authentication (if Aerospike Cluster is supporting it).|
|Path to a certificate blacklist file. The file should contain one line for each blacklisted certificate. Each line starts with the certificate serial number expressed in hex. Each entry may optionally specify the issuer name of the certificate (serial numbers are only required to be unique per issuer). Example: 867EC87482B2 /C=US/ST=CA/O=Acme/OU=Engineering/CN=TestChainCA|
|Enable CRL checking for leaf certificate. An error occurs if a valid CRL files cannot be found in tls_capath.|
|Enable CRL checking for entire certificate chain. An error occurs if a valid CRL files cannot be found in tls_capath.|
|Enable logging session information for each TLS connection.|
The tlsname is only used when connecting with a secure TLS enabled server.
The following example restores a cluster backup to node
184.108.40.206 using the default Aerospike port of
3000 with tls configured.
HOST is "
asrestore --host 220.127.116.11:cert1:3000 --directory backup_2015_08_24 --namespace test --tls-enable --tls-cafile /cluster_name.pem --tls-protocols TLSv1.2 --tls-keyfile /cluster_name.key --tls-certfile /cluster_name.pem
|-||Directory from which to read the |
|-||The single file from which to read the backup. |
|none||The decompression algorithm to be used on backup files as they are read. This option must match that used when taking the backup. The options available are |
|none||The decryption algorithm to be used on backup files as they are read. This option must match that used when taking the backup. The options available are |
Data Selection Options
|Original namespace||Namespace to be restored. By default, |
|All sets||The sets to restore.|
|All bins||The bins to restore.|
|-||Do not restore any record data (metadata or bin data). By default, |
|-||Do not restore any secondary index definitions. See above.|
|-||Do not restore any UDF modules. See above.|
|false||Ignore permanent record specific error. e.g AEROSPIKE_RECORD_TOO_BIG. By default such errors are not ignored and asrestore terminates. Optional: Use verbose mode to see errors in detail.|
Write Policy Options
|-||Existing records take precedence. With this option, only records that do not exist in the namespace are restored, regardless of generation numbers. If a record exists in the namespace, the record from the backup is ignored. Note: this option is mutually exclusive to |
|-||Records from backups take precedence. This option disables the generation check. With this option, records from the backup always overwrite records that already exist in the namespace, regardless of generation numbers. Note: this option is mutually exclusive to |
|-||Replace records. This controls how records from the backup overwrite existing records in the namespace. By default, restoring a record from a backup only replaces the bins contained in the backup; all other bins of an existing record remain untouched. With this option, the existing record is completely replaced; i.e., any bins that are not contained in the backup are discarded. This option still does a generation check by default and would need to be combined with the |
|-||For records with expirable void-times, add |
Restore from S3
To restore files from Amazon S3, prefix file/directory names with "s3://<bucket>/<key>", where <bucket> is the name of the S3 bucket to download from, and <key> is the key of the object to download/prefix of files in the S3 "directory". If using the default S3 endpoint,
--s3-region <region> must be set to the region that the bucket you're uploading to is in. If using another endpoint, specify that endpoint with
Files are downloaded in chunks of 5MB, and the maximum number of simultaneous downloads across all threads is controlled with
|-||Sets the S3 region of the bucket being uploaded to/downloaded from. Must be set if using the default S3 endpoint.|
|-||Sets the S3 endpoint to use. Must point to an S3-compatible storage system.|
|default||Sets the S3 profile to use for credentials.|
|32||The maximum number of simultaneous download requests from S3.|
To restore all records to an S3 bucket "test-bucket" in region "us-west-1" under directory "test-dir", run
asrestore -d s3://test-bucket/test-dir --s3-region us-west-1
Configuration File Options
asrestore can be configured by using tools configuration files. Please see Aerospike Tools Configuration for more details. The following options effect configuration file behavior.
|disabled||Do not read any configuration file. Mutually exclusive to |
|-||Section with these instance is read. e.g in case instance |
|-||Read this file after default configuration file.|
|-||Read only this configuration file. Mutually exclusive to |
|disabled||Output considerably more information about the running restore.|
|-||Create indexes after restoring everything else. By default, indexes are restored before everything else, which can prevent costly SSD reads required to build the indexes.|
|-||Wait for secondary indexes to finish building before proceeding. Wait for restored UDFs to be distributed across the cluster.|
|-||Output machine-readable status updates to the given path, typically a FIFO.|
If you would like to change the target set to which to restore data, please contact Aerospike Support for assistance.