Skip to content

Commit

Permalink
fix neo4j commands failing while executing backup (#2172)
Browse files Browse the repository at this point in the history
fix neo4j commands failing while executiing backup

(#2171)

(cherry picked from commit 6eba8cc)
  • Loading branch information
gnmahanth authored and ramanan-ravi committed May 30, 2024
1 parent 7706006 commit 0cce315
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion deepfence_neo4j/backup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/bash
docker run --rm --volumes-from deepfence-neo4j -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /data

2 changes: 1 addition & 1 deletion deepfence_neo4j/backup_neo4j.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [ $retVal -ne 0 ]; then
exit
fi

neo4j-admin dump --database='neo4j' --to=$BACKUP_FILE
neo4j-admin database dump neo4j --to-stdout > $BACKUP_FILE
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Failed to create the backup file"
Expand Down
4 changes: 2 additions & 2 deletions deepfence_neo4j/df.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ backup_db() {
touch /backups/.inprogress
neo4j stop
NOW=$(date +"%Y-%m-%d_%H-%M-%S")
neo4j-admin dump --database=neo4j --to="/backups/neo4j_$NOW.dump"
neo4j-admin database dump neo4j --to-stdout > /backups/neo4j_$NOW.dump
ls -tr /backups/*.dump | head -n -${MAX_NUM_BACKUPS:-5} | xargs --no-run-if-empty rm
start_db
rm /backups/.inprogress
Expand Down Expand Up @@ -75,7 +75,7 @@ else
echo "Backup already loaded, skipping"
else
echo "Start using backup: $USE_BACKUP"
neo4j-admin load --database=neo4j --from=$USE_BACKUP --force
cat $USE_BACKUP | neo4j-admin database load --from-stdin neo4j --overwrite-destination=true
mv $USE_BACKUP $USE_BACKUP.used
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion deepfence_neo4j/load_backup_neo4j.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [ $retVal -ne 0 ]; then
exit
fi

neo4j-admin load --from=$BACKUP_FILE --database='neo4j' --force
cat $BACKUP_FILE | neo4j-admin database load --from-stdin neo4j --overwrite-destination=true
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Failed to load the db file"
Expand Down

0 comments on commit 0cce315

Please sign in to comment.