<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 04/03/2012 05:10 AM, Livnat Peer wrote:
<blockquote cite="mid:4F7ABEA1.6030409@redhat.com" type="cite">
<pre wrap="">On 03/04/12 12:05, Eli Mesika wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
----- Original Message -----
</pre>
<blockquote type="cite">
<pre wrap="">From: "Douglas Landgraf" <a class="moz-txt-link-rfc2396E" href="mailto:dougsland@redhat.com"><dougsland@redhat.com></a>
To: "Adam Litke" <a class="moz-txt-link-rfc2396E" href="mailto:agl@us.ibm.com"><agl@us.ibm.com></a>
Cc: <a class="moz-txt-link-abbreviated" href="mailto:engine-devel@ovirt.org">engine-devel@ovirt.org</a>, "Douglas Landgraf" <a class="moz-txt-link-rfc2396E" href="mailto:dlandgra@redhat.com"><dlandgra@redhat.com></a>
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).
</pre>
</blockquote>
<pre wrap="">
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
</pre>
</blockquote>
<pre wrap="">
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?
</pre>
</blockquote>
If you guys are interested, I have updated the tool to work with
systemctl/enginedb and tested under Fedora 16:<br>
<br>
Here my use:<br>
<br>
# mkdir /engine-backup-db<br>
# chmod +x engine-db-tool.py<br>
<br>
backup manually<br>
=============<br>
./engine-db-tool.py --backup --path=/engine-db-backup<br>
Stopping jboss-as service...<br>
Backuping database:
/engine-db-backup/dump_RHEVDB_BACKUP_2012-04-03-15:05.sql<br>
Starting jboss-as service...<br>
Done<br>
<br>
<br>
restore manually<br>
=============<br>
# ./engine-db-tool.py --restore
--path=/engine-db-backup/dump_RHEVDB_BACKUP_2012-04-03-15:05.sql<br>
Stopping jboss-as service...<br>
Restoring database:
/engine-db-backup/dump_RHEVDB_BACKUP_2012-04-03-15:05.sql<br>
Starting jboss-as service...<br>
Done<br>
<br>
<br>
Crontab<br>
=======<br>
# crontab -e (adding to my crontab user)<br>
<br>
# Every day 18:00 backup db<br>
00 18 * * * /path-to/engine-db-tool.py --backup
--path=/engine-backup-db<br>
<br>
<br>
Download:
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="https://raw.github.com/dougsland/misc-rhev/master/engine-db-tool.py">https://raw.github.com/dougsland/misc-rhev/master/engine-db-tool.py</a><br>
<br>
Thanks!<br>
<br>
<pre class="moz-signature" cols="72">--
Cheers
Douglas</pre>
</body>
</html>