Validate backup files with asrestore
This page describes how to validate backup files with asrestore
.
Overview
When used with the --validate
option, asrestore
identifies invalid backup files and displays bad data.
Validate mode works with options such as --directory
, --input-file
, or --directory-list
to specify backups for asrestore
. Validate mode ignores data selection and Aerospike TLS- or connection-related
arguments because no connection is made to the database. To validate backups in an Amazon S3 bucket, you need to make a connection to S3.
Validate mode cannot detect all corrupted data. The tool only identifies issues that may cause errors when parsing the backup files. For example, if a backup file contains a record with corrupted data that can still be considered a valid record, then that issue will not be identified. For more information, see Backup File Format.
Example
The following example illustrates the process to create a backup file and validate its data:
Back up a single record to a directory:
% asbackup -h 127.0.0.1:3000 -n test -d test-backup-dir
...
2023-07-19 20:33:55 UTC [INF] [81932] Backed up 1 record(s), 0 secondary index(es), 0 UDF file(s), 168 byte(s) in total (~168 B/rec)
% ls test-backup-dir
test_00000.asb
% cat test-backup-dir/test_00000.asb
Version 3.1
# namespace test
# first-file
+ k S 4 key1
+ n test
+ d 7JEZLUt/jONdXXjTS8ply6qqyWA=
+ s demo
+ g 1
+ t 430086781
+ b 3
- I foo 123
- S bar 3 abc
- Z baz TCreate corruption in the backup file:
% sed -i '' -e 's/S/2/g' ./test-backup-dir/test_00000.asb
% cat test-backup-dir/test_00000.asb
Version 3.1
# namespace test
# first-file
+ k 2 4 key1
+ n test
+ d 7JEZLUt/jONdXXjT28ply6qqyWA=
+ s demo
+ g 1
+ t 430086781
+ b 3
- I foo 123
- 2 bar 3 abc
- Z baz TRun
asrestore
in validate mode:% ./bin/asrestore --validate -d test-backup-dir
2023-07-19 20:48:42 UTC [INF] [94673] Starting validation of test-backup-dir
2023-07-19 20:48:42 UTC [INF] [94673] Found 1 backup file(s) in test-backup-dir
2023-07-19 20:48:42 UTC [INF] [94673] Validating backup files
2023-07-19 20:48:42 UTC [INF] [94673] Finished validating backup file(s)
2023-07-19 20:48:42 UTC [INF] [94675] validating test-backup-dir/test_00000.asb
2023-07-19 20:48:42 UTC [INF] [94675] Opened backup file test-backup-dir/test_00000.asb
2023-07-19 20:48:42 UTC [ERR] [94675] Invalid key type character "2" in block (line 4, col 5)
2023-07-19 20:48:42 UTC [ERR] [94675] Error while parsing record
2023-07-19 20:48:42 UTC [ERR] [94675] Error while parsing backup file test-backup-dir/test_00000.asb (line 4)
2023-07-19 20:48:42 UTC [INF] [94674] 0 UDF file(s), 0 secondary index(es), 0 record(s) (0 rec/s, 11 KiB/s, 0 B/rec, retries: 0)
2023-07-19 20:48:42 UTC [INF] [94674] Expired 0 : skipped 0 : err_ignored 0 : inserted 0: failed 0 (existed 0 , fresher 0)
2023-07-19 20:48:42 UTC [INF] [94674] 27% complete, ~0s remaining
If you want to change the destination set for restoring data, contact Aerospike Support for assistance.