Overview
TheRedisBackup custom resource defines an on-demand backup of a RedisCluster to object storage.
API Group: redis.io/v1Kind:
RedisBackupShort Name:
rb
Spec Fields
Name of the RedisCluster to back up
Specifies which pod to run the backup onEnum values:
primary- Always run backup on the primary instanceprefer-replica- Run on a replica if available, otherwise on the primary
Backup method to useEnum values:
rdb- Redis Database file (point-in-time snapshot viaBGSAVE)aof- Append-only file (viaBGREWRITEAOF, archived as.tar.gz)
Defines where to store the backup
Status Fields
Current backup phasePossible values:
Pending- Backup scheduled but not startedRunning- Backup in progressCompleted- Backup completed successfullyFailed- Backup failed (seeerrorfield)
Pod name that is running or ran the backupExample:
my-redis-1When the backup started
When the backup completed (success or failure)
Size of the backup in bytes
Object storage path/key where the backup is writtenExample:
s3://my-bucket/backups/my-backup.rdbFormat of the backup artifact in object storageEnum values:
rdb- Redis Database file (.rdb)aof-archive- AOF directory archived as.aof.tar.gz
Error message if the backup failed
Latest available observations
Backup Workflow
RDB Backups
- Operator selects target pod based on
spec.target - Operator POSTs to
/v1/backupon target pod’s IP - Instance manager issues
BGSAVEto Redis - Instance manager polls
INFO persistenceuntilrdb_bgsave_in_progress=0 - Instance manager reads
/data/dump.rdb - Instance manager uploads to S3 with SHA256 checksum
- Operator updates status with
backupPath,backupSize,checksumSHA256
AOF Backups
- Operator selects target pod based on
spec.target - Operator POSTs to
/v1/backupon target pod’s IP - Instance manager issues
BGREWRITEAOFto Redis - Instance manager polls
INFO persistenceuntilaof_rewrite_in_progress=0 - Instance manager creates
.tar.gzarchive of/data/appendonlydir/ - Instance manager uploads to S3 with SHA256 checksum
- Instance manager deletes temporary archive file
- Operator updates status with
backupPath,backupSize,checksumSHA256
Credentials
Backup credentials are mounted from the Secret referenced inspec.backupCredentialsSecret at /backup-credentials.
The instance manager supports multiple key names for AWS credentials:
| Credential | Supported Keys |
|---|---|
| Access Key ID | AWS_ACCESS_KEY_ID, aws_access_key_id, accessKeyId, access_key_id |
| Secret Access Key | AWS_SECRET_ACCESS_KEY, aws_secret_access_key, secretAccessKey, secret_access_key |
| Session Token | AWS_SESSION_TOKEN, aws_session_token, sessionToken, session_token |