On 04/03/2012 05:10 AM, Livnat Peer wrote:
On 03/04/12 12:05, Eli Mesika wrote:

----- Original Message -----
From: "Douglas Landgraf"<dougsl...@redhat.com>
To: "Adam Litke"<a...@us.ibm.com>
Cc: engine-devel@ovirt.org, "Douglas Landgraf"<dland...@redhat.com>
Sent: Monday, April 2, 2012 6:19:23 PM
Subject: Re: [Engine-devel] Backing up the DB


Hi,

On 04/02/2012 09:20 AM, Adam Litke wrote:

Hi all,

I have a working development environment for ovirt-engine and I want
to verify
someone else's gerrit change.  Is there a documented proceedure for
backing up
the engine db so that, after checking out the new code and updating
the db
schema, I can revert to my old code and DB (schema and data).
You can use pg_dump for backup and psql for restore :

backup:
pg_dump -C -E UTF8  --column-inserts --disable-dollar-quoting  --disable-triggers -U 
postgres --format=p -f<backupfile>   <dbname>

restore:
psql -U postgres -f<backupfile>   template1


Eli,
Can we have a script for backup and restore DB in the repo?

I see we have backup_db.sql any use of it?

If you guys are interested, I have updated the tool to work with systemctl/enginedb and tested under Fedora 16:

Here my use:

# mkdir /engine-backup-db
# chmod +x engine-db-tool.py

backup manually
=============
 ./engine-db-tool.py --backup --path=/engine-db-backup
Stopping jboss-as service...
Backuping database: /engine-db-backup/dump_RHEVDB_BACKUP_2012-04-03-15:05.sql
Starting jboss-as service...
Done


restore manually
=============
# ./engine-db-tool.py --restore --path=/engine-db-backup/dump_RHEVDB_BACKUP_2012-04-03-15:05.sql
Stopping jboss-as service...
Restoring database: /engine-db-backup/dump_RHEVDB_BACKUP_2012-04-03-15:05.sql
Starting jboss-as service...
Done


Crontab
=======
# crontab -e  (adding to my crontab user)

# Every day 18:00 backup db
00 18 * * * /path-to/engine-db-tool.py --backup --path=/engine-backup-db


Download: https://raw.github.com/dougsland/misc-rhev/master/engine-db-tool.py

Thanks!

--
Cheers
Douglas

_______________________________________________
Engine-devel mailing list
Engine-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-devel

Reply via email to