[Engine-devel] Backing up the DB
Douglas Landgraf
dougsland at redhat.com
Tue Apr 3 20:10:46 UTC 2012
On 04/03/2012 05:10 AM, Livnat Peer wrote:
> On 03/04/12 12:05, Eli Mesika wrote:
>>
>> ----- Original Message -----
>>> From: "Douglas Landgraf"<dougsland at redhat.com>
>>> To: "Adam Litke"<agl at us.ibm.com>
>>> Cc: engine-devel at ovirt.org, "Douglas Landgraf"<dlandgra at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20120403/b6f5dc08/attachment-0002.html>
More information about the Devel
mailing list