Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > advice on backing up a DB from server?

Reply
Thread Tools

advice on backing up a DB from server?

 
 
dan baker
Guest
Posts: n/a
 
      05-21-2004
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
 
Reply With Quote
 
 
 
 
Keith Keller
Guest
Posts: n/a
 
      05-21-2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In article <(E-Mail Removed) >, dan baker wrote:
> 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

- --
http://www.velocityreviews.com/forums/(E-Mail 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-----
 
Reply With Quote
 
 
 
 
dan baker
Guest
Posts: n/a
 
      05-21-2004
Keith Keller <(E-Mail Removed)-francisco.ca.us> wrote in message
....
> 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
 
Reply With Quote
 
dan baker
Guest
Posts: n/a
 
      05-21-2004
....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
 
Reply With Quote
 
J. Gleixner
Guest
Posts: n/a
 
      05-21-2004
dan baker wrote:

> 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.
 
Reply With Quote
 
gnari
Guest
Posts: n/a
 
      05-21-2004
"dan baker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> ...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




 
Reply With Quote
 
Ben Morrow
Guest
Posts: n/a
 
      05-21-2004

Quoth http://www.velocityreviews.com/forums/(E-Mail 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

--
Outside of a dog, a book is a man's best friend.
Inside of a dog, it's too dark to read.
(E-Mail Removed) Groucho Marx
 
Reply With Quote
 
Gregory Toomey
Guest
Posts: n/a
 
      05-22-2004
dan baker wrote:

> 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
 
Reply With Quote
 
Gregory Toomey
Guest
Posts: n/a
 
      05-22-2004
dan baker wrote:

> ...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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Backing up harddrive advice please? Caroline Computer Support 5 06-19-2006 01:38 AM
Re: Seeking advice on backing up HD Wizard Computer Support 4 03-08-2005 08:47 PM
Re: Seeking advice on backing up HD Wizard Computer Information 8 03-08-2005 01:46 PM
Re: Seeking advice on backing up HD Wizard Computer Support 8 03-08-2005 01:46 PM
Re: Seeking advice on backing up HD Wizard Computer Information 2 03-07-2005 09:58 PM



Advertisments