Elasticsearch Backup
Elasticsearch backup captures all indices and their data, excluding system indices.
Backup Process:
The es-backup.sh script performs the
following operations:
(Click the file name above to download the script.)
- Retrieves Elasticsearch credentials from Kubernetes secrets
- Establishes port-forward to Elasticsearch service (automatic)
- Tests connectivity to the Elasticsearch cluster
- Uses
multielasticdumpto export all non-system indices - Saves index data to a temporary directory
- Creates a compressed tar.gz archive
- Cleans up temporary files
Running the Backup:
./es-backup.sh
Expected Output:
========================================
Elasticsearch Backup - Elasticdump
========================================
Archive: ./elasticsearch-backup-20251103-122933.tar.gz
Checking connection... OK
✓ Connected to Elasticsearch
Starting backup...
✓ Backup completed
Size: 40K
Indices: 83
Location: ./elasticsearch-backup-20251103-122933.tar.gz
Log: ./elasticsearch-backup-20251103-122933.log
What Gets Backed Up:
-
All user-created indices (excluding system indices starting with
.) -
Index mappings and settings
-
All documents within each index
-
Index aliases and templates
Port Forwarding: The script automatically manages port-forwarding to the Elasticsearch service. No manual port-forward setup is required.
Backup File Location: Two files are created:
-
elasticsearch-backup-<timestamp>.tar.gz: The compressed backup archive -
elasticsearch-backup-<timestamp>.log: Detailed backup log