Backup & Restore Metrics
Learn how to backup and restore metrics into groundcover metrics storage
groundcover uses VictoriaMetrics as its underlying metrics storage solution. As such, groundcover integrates seamlessly with VictoriaMetrics vmbackup and vmrestore tools.
Doing incremental backups
port-forward groundcover's VictoriaMetrics service object
kubectl get svc -n groundcover | grep "victoria-metrics"
# Identify the victoria-metrics service object name
kubectl port-forward svc/{victoria-metrics-service-object-name} \
-n groundcover 8428:8428
Run the
vmbackup
utility, in this example we'll set the destination to an AWS S3 bucket, but more providers are supported
./vmbackup -credsFilePath={aws credentials path} \
-storageDataPath=</path/to/victoria-metrics-data> \
-snapshot.createURL=http://localhost:8428/snapshot/create \
-dst=s3://<bucket>/<path/to/backup>
Restoring from backup
Scale down VictoriaMetrics statefulSet (VictoriaMetrics must be offline during restorations)
kubectl scale sts {release name}-victoria-metrics --replicas=0
Get the VictoriaMetrics PVC name
kubectl get pvc -n groundcover | grep victoria-metrics
Create the following Kubernetes Job manifest
vm-restore.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: vm-restore
annotations:
eks.amazonaws.com/role-arn: XXXXX # role with permissions to write to the bucket
---
apiVersion: batch/v1
kind: Job
metadata:
name: vm-restore
spec:
ttlSecondsAfterFinished: 600
template:
spec:
serviceAccountName: vm-restore
restartPolicy: OnFailure
volumes:
- name: vmstorage-volume
persistentVolumeClaim:
claimName: "{VICTORIA METRICS PVC NAME}"
containers:
- name: vm-restore
image: victoriametrics/vmrestore
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /storage
name: vmstorage-volume
command:
- /bin/sh
- -c
- /vmrestore-prod -src=s3://<bucket>/<path/to/backup> -storageDataPath=/storage
Deploy the job and wait for completion
kubectl apply -f vm-restore.yaml -n groundcover
Once completed, scale up groundcover's VictoriaMetrics instance
kubectl scale sts {release name}-victoria-metrics --replicas=1
Last updated