Backup and Recovery
Configuration backup, disaster recovery procedures, and capacity planning.
This section covers configuration backup using the built-in backup script. For Energylogserver data snapshot backup and disaster recovery procedures, see Installation - Disaster Recovery.
Configuration Backup
Backing up
The backup bash script is located on the hosts with Data Node in the location: /usr/share/logserver/utils/configuration-backup.sh.
The script is responsible for backing up the basic data in the Logserver system (these data are the system indexes found in logserver of those starting with a dot ‘.’ in the name), the configuration of the entire cluster, the set of templates used in the cluster and all the components.
These components include the Network Probe configuration located in /etc/logserver-probe and the Logserver GUI configuration located in /etc/logserver-gui.
All data is stored in the /tmp folder and then packaged using the /usr/bin/tar utility to tar.gz format with the exact date and time of execution in the target location, then the files from /tmp are deleted.
crontab
It is recommended to configure crontab.
Before executing the following commands, you need to create a crontab file, set the path to backup, and direct them there.
In the below example, the task was configured on hosts with the Data Node module on the root.
# crontab -l #Printing the Crontab file for the currently logged in user
0 1 * * * /bin/bash /usr/share/logserver/utils/configuration-backup.sh
The client-node host saves the backup in the /archive/configuration-backup/ folder.
Receiver-node hosts save the backup in the /root/backup/ folder.
Restoration from backup
Backup and Restore guide is available under this link
Performance Monitoring and Optimization
Performance Metrics
Monitoring Commands:
top -p $(pgrep -f "energy-logserver|java")
free -h
df -h | grep -E "(energy-logserver|var)"
Optimization Techniques
JVM Tuning (extending Chapter 3):
TOTAL_RAM=$(free -g | awk '/^Mem:/{print $2}')
HEAP_SIZE=$((TOTAL_RAM / 2))
echo "-Xms${HEAP_SIZE}g" > /etc/energy-logserver/jvm.options.d/heap.options
echo "-Xmx${HEAP_SIZE}g" >> /etc/energy-logserver/jvm.options.d/heap.options
echo "-XX:+UseG1GC" >> /etc/energy-logserver/jvm.options.d/gc.options
Query Optimization:
curl -k -X PUT "https://localhost:9200/_cluster/settings" \
-H "Content-Type: application/json" \
-d '{
"persistent": {
"index.search.slowlog.threshold.query.warn": "10s"
}
}'
Capacity Planning
Capacity Metrics
Monitoring Commands:
curl -k https://localhost:9200/_cat/indices?v&s=store.size:desc
curl -k https://localhost:9200/_cat/allocation?v
Planning Guidelines
Daily Ingestion Calculation:
Monitor EPS from Skimmer
Project growth based on trends
Allocate 20% buffer for peaks
Storage Forecasting:
curl -k https://localhost:9200/_cat/indices?v&s=docs.count:desc | head -10
Backup Procedures
Snapshot Creation:
curl -X PUT "localhost:9200/_snapshot/backup_repo/snapshot_$(date +%Y%m%d)" \
-H 'Content-Type: application/json' \
-d '{
"indices": "*",
"ignore_unavailable": true,
"include_global_state": false
}'
Configuration Backup:
rsync -avz /etc/energy-logserver/ /backup/config/$(date +%Y%m%d)/
rsync -avz /etc/kibana/ /backup/config/$(date +%Y%m%d)/
Recovery Procedures
Snapshot Restoration:
curl -X POST "localhost:9200/_snapshot/backup_repo/snapshot_date/_restore" \
-H 'Content-Type: application/json' \
-d '{
"indices": "*",
"ignore_unavailable": true,
"include_global_state": false
}'
Configuration Restore:
rsync -avz /backup/config/date/ /etc/energy-logserver/
systemctl restart energy-logserver kibana