Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Geographically Separate Locations

If you are considering a backup strategy for Production Data, do consider storing the backup offsite. A geographically different location ensures that events like flooding or fire, don't destroy all the backups too!

 

To perform an full backup of all Bahmni Databases, one can use the following command in bahmni-environment/scripts:

 

Backup All DBs
sudo ./backup-all-dbs.sh -b /tmp/backup

 

If you want to setup an automated schedule to backup, then you can create a crontab entry to trigger this command periodically. For example:

 

Auto-schedule backups of DB
# Edit the crontab file of root user
crontab -u root -e 
 
# Make entry as (for running twice a day at 2PM, and 10PM)
00 14,22 * * * sudo /Project/bahmni-environment/scripts/backup-all-dbs.sh -b /tmp/backup

 

For more examples on crontab entries read this: crontab

 

To restore DB, use the following commands (ensure tomcat & openerp services are Stopped): 

Restore Databases
###################################
# One shot restore command:
###################################
sudo ./restore-all-dbs.sh -m /backup/mysql-dump.sql.gz -p /backup/pgsql-dump.sql.gz
 
 
###################################
# Or individual restore commands:
###################################
 
# Unzip the backups:
gzip -d [filename.gz]
 
# Restore MYSQL (script is in bahmni-environment)
./scripts/restore-mysql.sh [mysql-backup-filename]
 
# Restore Postgres (script is in bahmni-environment)
./scripts/restore-pgsql.sh [pgsql-backup-filename]
 
# If pgsql restore fails because of open connections, then you can restart postgres by executing:
sudo /etc/rc.d/init.d/postgresql-9.2 stop
sudo /etc/rc.d/init.d/postgresql-9.2 start 
  • No labels