Yung Le wrote:
I already read this FAQ before I post this question. Since my database
spread to many mount points in system. If I follow the instruction from FAQ
to setup a differnet tar program to backup a few partitions. I need to
stop/start or enable/disable hotbackup mode many times when amanda call the
GNUTAR program to backup. Or when I backup a partition without database the
new GNUTAR still call to shutdown database...
You're not limited to the simple script in the FOM.
If you have many partitions, you shutdown the db when amanda issues
the first one to backup; keep the state in a file in e.g. /tmp/amanda.
When the last partition is backed up, then you can start the db again.
The script becomes a little more complicated, because you cannot be
sure which one will be first or last; but it still isn't rocket science.
Some quick, untested skeleton:
if # already stopped the db?
test ! -f /tmp/amanda/db-parts &&
# one of the db-partitions?
grep "^$CURDIR\$" /usr/local/etc/db-parts >/dev/null
then
/usr/local/bin/dbshut # shut it down
# keep list of partitions todo
cp /usr/local/etc/db-parts /tmp/amanda/db-parts
fi
[...]
/usr/local/bin/gtar "$@" # now do the backup
[...]
if # remove this part from the todo list
grep -v "^$CURDIR\$" /tmp/amanda/db-parts \
> /tmp/amanda/db-parts.$$ &&
mv /tmp/amanda/db-parts.$$ /tmp/amanda/db-parts
`wc -l /tmp/amanda/db-parts` -eq 0 # last one?
then
rm /tmp/amanda/db-parts
/usr/local/bin/dbstart
fi
(Other tests need to be added, and output needs to be redirected
to the correct fd.)
Instead of shutting down, you could also switch the db to hot backup
mode for the complete duration of the backup.
Or if you have snapshots, then you could shutdown the db (or switch to
hotbackup), snapshot all the partitions, and startup again, and then
let amanda do her thing. In this case, you only need to know when
to start the snapshot.
Because taking a snapshot takes only minutes at most, you could do
this outside the normal amanda backup with a separate cron entry that
runs a safe time before amanda starts.
(That's how I do it currently.)
A complete different approach is to set up rsh/ssh capabilities from the
amanda server the the database server and run the shutdown/startup
scripts as remote commands from within the little shell script that
start amdump. Now the downtime window is longer, because the database
will be down including the estimate phase, and has to wait for the last
amanda clien too. (Maybe not too bad if it is only hotbackup mode.)
--
Paul Bijnens, Xplanation Tel +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM Fax +32 16 397.512
http://www.xplanation.com/ email: Paul.Bijnens AT xplanation DOT com
***********************************************************************
* I think I've got the hang of it now: exit, ^D, ^C, ^\, ^Z, ^Q, F6, *
* quit, ZZ, :q, :q!, M-Z, ^X^C, logoff, logout, close, bye, /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt, abort, hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e, kill -1 $$, shutdown, *
* kill -9 1, Alt-F4, Ctrl-Alt-Del, AltGr-NumLock, Stop-A, ... *
* ... "Are you sure?" ... YES ... Phew ... I'm out *
***********************************************************************
|