[Engine-devel] Backing up the DB

Yair Zaslavsky yzaslavs at redhat.com
Wed Apr 4 06:18:00 UTC 2012


On 04/04/2012 09:16 AM, Yair Zaslavsky wrote:
> On 04/03/2012 11:10 PM, Douglas Landgraf wrote:
>> On 04/03/2012 05:10 AM, Livnat Peer wrote:
>>> On 03/04/12 12:05, Eli Mesika wrote:
> 
> Eli - maybe we can take the script of Douglas and add it to the git repo?
Actually, I'll correct myself - I think we should produce a bash version
of it. What do you think?

> 
>>>>
>>>> ----- 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
>>
>>
>>
>> _______________________________________________
>> Engine-devel mailing list
>> Engine-devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/engine-devel
> 
> _______________________________________________
> Engine-devel mailing list
> Engine-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel




More information about the Engine-devel mailing list