Is it possible to store the AOF and RDB data on external storage system? Basicaclly my Redis cluster is deployed in a Kubernetes cluster and I need to ensure there is a durable backup of data for each shard. In case a master and its replica go down, there is another backup of the data from which the new master and its new replica could boot from.
Are you using Deployment
s or StatefulSet
s? I wouldn’t recommend Deployment
s because there are so many things that can go wrong with them with persistent storage, but if you use StatefulSet
s, persistence requires only 3 things:
- add
spec.volumeClaimTemplates
to the manifest - add
spec.template.spec.containers[].volumeMounts
to use that volume claim - tell the
redis-server
process to use the path you specified forvolumeMounts
- in the below example, you would specify
dir /redis-data
in your config
- in the below example, you would specify
apiVersion: apps/v1
kind: StatefulSet
metadata:
# ...
spec:
template:
spec:
containers:
- name: server
# other container config
volumeMounts:
- name: redis-data
mountPath: /redis-data
volumeClaimTemplates:
- metadata:
name: redis-data
spec:
accessModes: [ReadWriteOnce]
# your Kubernetes provider should have docs about storage classes
storageClassName: "your-storage-class"
resources:
requests:
storage: 1Gi # Edit to the size you need
1 Like