advice on backing up a DB from server?

D

dan baker

I have a small database on a remote webserver that I would like to
back up daily. The host does NOT make backups, except by special
request and extra fees. I was thinking I could mirror either to my
localhost, or mail it to myself via email, or something... I would
appreciate some feedback as to what a good approach might be.

The host I use does allow the configuration of cron jobs, so I could
write a little perl script to fire up nightly on the remote host. I
just don't know what the easiet/best approach might be, or what
modules might make this a slam dunk.

I do have a localhost running at home that I use for testing, but I
dont know if it is possible to mirror file(s) from a domain on the web
to my localhost? I don't have a fixed IP, it is dynamically assigned
from my ISP.

I was thinking about the email approach, but wasn't sure what the
easiest way would be to attach the DB as a binary attachment and send
it to myself. Is this a decent way to go? The database is fairly small
(about 1MB), and doesnt get any activity at night.

d
 
K

Keith Keller

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a small database on a remote webserver that I would like to
back up daily. [snip]
The host I use does allow the configuration of cron jobs, so I could
write a little perl script to fire up nightly on the remote host. I
just don't know what the easiet/best approach might be, or what
modules might make this a slam dunk.

I have three pieces of advice:

1) Investigate the tools your database software has for backing up
your database. They will certainly be helpful, even if you decide to
roll your own eventually.

2) Look into the DBI module and the DBD::* modules.

3) Don't post database questions to comp.lang.perl.misc. If you end
up writing Perl code, and need help, then you might try this newsgroup
first. But database questions are probably more appropriate somewhere
else.

- --keith

- --
(e-mail address removed)-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)

iD8DBQFAriDihVcNCxZ5ID8RAohUAJ95lt3/yfKypclnB9ohh4unj5n4zACePOYV
O0zwbORubrz1ap+/8ncRzqQ=
=rWkG
-----END PGP SIGNATURE-----
 
D

dan baker

Keith Keller said:
1) Investigate the tools your database software has for backing up
your database. They will certainly be helpful, even if you decide to
roll your own eventually.
----------
the DB is a really simple one using perl DB_file and tie(). But that
is irrelevant.

3) Don't post database questions to comp.lang.perl.misc. If you end
up writing Perl code, and need help, then you might try this newsgroup
first. But database questions are probably more appropriate somewhere
else.
---------------
my question is not a "database question."
I would like some input on possible perl-driven approaches to back up
some files from a remote server to my local computer. I was thinking
that perhaps people could give some meaningful advise on the pros and
cons of using perl modules like Net:FTP or Mirror, or whether it might
be best to push it from the remote server, or pull it from my
computer. My question IS: what might be the simplest, easiest perl
module to copy a file from a remote server to my local computer.

Get off your high-horse, and contribute a meaningful reply if you have
one.

d
 
D

dan baker

....just to clarify, I would like comments on whether it will be easier
to build a script on my local computer to "pull" specific files from a
remote host, or if it is possible to run a cron job on the remote host
to "push" the files to my computer (assuming I am connected to the
internet.)

currently it looks like it may be easiest to code a little routine to
GET the files, probably using Net::FTP . Or, do I need to use
Win32::Internet module since I would be running the script from a PC
running Windows98 ?

The second part of this is how do I do a "cron-like" wrapper that
would fire up the transfer in the middle of the night automatically?
What module would I use to do something like this on a PC running
Windows98 ?

thanks,

d
 
J

J. Gleixner

dan said:
My question IS: what might be the simplest, easiest perl
module [that allows me] to copy a file from a remote server to my local computer.
Had you simply asked that question you may have received more helpful
advice. Also, before asking, download a module and try it. If you have
questions or problems, post the code. All you trying to do is copy a
file, it's trivial no matter what module you use. It could also be an
even simpler shell script.

To answer your question. It doesn't have anything to do with perl, it
really depends on what Protocol your servers support or have running.
Use what you know, like, or have available. Since we don't know that,
it's not possible to answer.

If you're familiar with FTP, and your servers are running FTP, then by
all means use Net::FTP, if you want something secure, use scp and
Net::SCP. If you like using some other Protocol, then use it.

It's better to pull the information, that way you can have one script to
contol how and when and can also handle errors more easily.
 
G

gnari

dan baker said:
...just to clarify, I would like comments on whether it will be easier
to build a script on my local computer to "pull" specific files from a
remote host, or if it is possible to run a cron job on the remote host
to "push" the files to my computer (assuming I am connected to the
internet.)

have a cron job on remote server backup your files with tar
if push is an option, just have your cron job do that too. my
preference is to use scp
if push is not an option, just pull the prepared backup at
your leisure.

gnari
 
B

Ben Morrow

Quoth (e-mail address removed) (dan baker):
...just to clarify, I would like comments on whether it will be easier
to build a script on my local computer to "pull" specific files from a
remote host, or if it is possible to run a cron job on the remote host
to "push" the files to my computer (assuming I am connected to the
internet.)

That is likely to be tricky with no static IP, unless you register with
dyndns.org or whatever.
currently it looks like it may be easiest to code a little routine to
GET the files, probably using Net::FTP . Or, do I need to use
Win32::Internet module since I would be running the script from a PC
running Windows98 ?

Net::FTP and LWP both work perfectly well under Win32. I would imagine
you'll find LWP easier to use.
The second part of this is how do I do a "cron-like" wrapper that
would fire up the transfer in the middle of the night automatically?
What module would I use to do something like this on a PC running
Windows98 ?

You would use Windows' Scheduled Tasks.

Ben
 
G

Gregory Toomey

dan said:
I have a small database on a remote webserver that I would like to
back up daily. The host does NOT make backups, except by special
request and extra fees. I was thinking I could mirror either to my
localhost, or mail it to myself via email, or something... I would
appreciate some feedback as to what a good approach might be.

The host I use does allow the configuration of cron jobs, so I could
write a little perl script to fire up nightly on the remote host. I
just don't know what the easiet/best approach might be, or what
modules might make this a slam dunk.

I do have a localhost running at home that I use for testing, but I
dont know if it is possible to mirror file(s) from a domain on the web
to my localhost? I don't have a fixed IP, it is dynamically assigned
from my ISP.
Irrelevant.


I was thinking about the email approach, but wasn't sure what the
easiest way would be to attach the DB as a binary attachment and send
it to myself. Is this a decent way to go? The database is fairly small
(about 1MB), and doesnt get any activity at night.

d

I have numerous database enabled sites.

My advice (after many years doing this) is:

1. Get a VPN linux server, running user mode linux. I use www.linode.com
This gives you full root access.
2. Run your favourite database backup utility provided by your DBMS,
preferably that writes data as as ASCII file.
4. run rsync to copy the backed up database to another machine

gtoomey
 
G

Gregory Toomey

dan said:
...just to clarify, I would like comments on whether it will be easier
to build a script on my local computer to "pull" specific files from a
remote host, or if it is possible to run a cron job on the remote host
to "push" the files to my computer (assuming I am connected to the
internet.)

Use rsync - its a one liner.

gtoomey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top