Backup
The backup script is installed at /opt/energysoar/lib/extra/backup.sh.
Run it as root. Output files are written to /root/.
Backup modes
The script supports three modes:
Flag |
Mode |
What is backed up |
|---|---|---|
(none) |
Config only |
Configuration files. Output: |
|
Data only |
Elasticsearch indices, Cassandra data, n8n data. Output: |
|
Full backup |
Config and data combined. |
Config backup
Backs up all configuration directories:
/etc/cortex//opt/cortex/Energy-Analyzers//etc/energysoar//var/lib/n8n/.n8n//opt/energysoar/n8n/scripts//etc/nginx/conf.d/energysoar.conf/etc/cassandra/
/opt/energysoar/lib/extra/backup.sh
The resulting ZIP is saved as /root/backup_energysoar_config_TIMESTAMP.zip.
Data backup
Exports:
Elasticsearch indices (using
elasticdump)Cassandra keyspace tables (using
cqlsh COPY) and scheman8n workflow data from
/var/lib/n8n/.n8n/
/opt/energysoar/lib/extra/backup.sh -d
The resulting ZIP is saved as /root/backup_energysoar_data_TIMESTAMP.zip.
Full backup
Runs config backup followed by data backup:
/opt/energysoar/lib/extra/backup.sh -a
HA mode
In a high-availability cluster, pass the -H flag. The script will prompt for
Cassandra credentials before exporting cluster data:
/opt/energysoar/lib/extra/backup.sh -H
/opt/energysoar/lib/extra/backup.sh -a -H
Credentials can also be passed via environment variables to avoid interactive prompts:
CASS_USER=energysoar CASS_PASS=password /opt/energysoar/lib/extra/backup.sh -a -H
Restore
The restore procedure varies by what failed. Always stop all services before restoring data and restart them afterwards.
Stop services before restore:
systemctl stop energysoar cortex n8n nginx
Restore configuration
Extract the config backup archive to the root of the filesystem:
unzip /root/backup_energysoar_config_TIMESTAMP.zip -d /
This overwrites /etc/cortex/, /etc/energysoar/, /etc/nginx/,
/etc/cassandra/, and the n8n scripts directory with the backed-up versions.
Verify file ownership after extraction — files must be readable by the
energysoar and cortex service users.
Restore data
Extract the data backup archive:
unzip /root/backup_energysoar_data_TIMESTAMP.zip -d /tmp/energysoar-restore
Cassandra — ensure Cassandra is running before importing:
systemctl start cassandra
cd /tmp/energysoar-restore/cassandra/
cqlsh -e "SOURCE 'schema.cql';"
cqlsh -e "COPY energysoar.<table_name> FROM '<table_name>.csv' WITH DELIMITER='|' AND HEADER=TRUE;"
Repeat the COPY command for each .csv file in the directory.
Elasticsearch / Energy Logserver — restore each index using elasticdump:
cd /tmp/energysoar-restore/elasticsearch/
for f in *_mapping.json; do
index="${f%%_mapping.json}"
elasticdump --input="${index}_mapping.json" \
--output="http://127.0.0.1:9200/${index}" \
--type=mapping
elasticdump --input="${index}.json" \
--output="http://127.0.0.1:9200/${index}" \
--type=data
done
n8n workflows — copy the n8n data directory back:
cp -r /tmp/energysoar-restore/n8n/.n8n/ /var/lib/n8n/
chown -R n8n:n8n /var/lib/n8n/.n8n/
Start services after restore:
systemctl start cassandra elasticsearch energysoar cortex n8n nginx
Verify that all services are healthy using:
systemctl status energysoar cortex n8n
See Diagnostics for health check endpoints to confirm data availability.