advice on backing up a DB from server?

Discussion in 'Perl Misc' started by dan baker, May 21, 2004.

  1. dan baker

    dan baker Guest

    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
     
    dan baker, May 21, 2004
    #1
    1. Advertising

  2. dan baker

    Keith Keller Guest

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

    In article <>, 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

    - --
    -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-----
     
    Keith Keller, May 21, 2004
    #2
    1. Advertising

  3. dan baker

    dan baker Guest

    Keith Keller <-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
     
    dan baker, May 21, 2004
    #3
  4. dan baker

    dan baker Guest

    ....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
     
    dan baker, May 21, 2004
    #4
  5. dan baker

    J. Gleixner Guest

    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.
     
    J. Gleixner, May 21, 2004
    #5
  6. dan baker

    gnari Guest

    "dan baker" <> wrote in message
    news:...
    > ...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
     
    gnari, May 22, 2004
    #6
  7. dan baker

    Ben Morrow Guest

    Quoth (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.
    Groucho Marx
     
    Ben Morrow, May 22, 2004
    #7
  8. 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
     
    Gregory Toomey, May 22, 2004
    #8
  9. 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
     
    Gregory Toomey, May 22, 2004
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin Schmid

    Backing up Project Files

    Martin Schmid, Oct 23, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    341
    Martin Schmid
    Oct 23, 2003
  2. Brian Mitchell
    Replies:
    2
    Views:
    2,917
    Brian Mitchell
    Feb 15, 2004
  3. J. Frank Parnell

    backing up an asp database

    J. Frank Parnell, Mar 3, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    406
    J. Frank Parnell
    Mar 3, 2005
  4. Micke
    Replies:
    6
    Views:
    7,381
    Remmel
    Jan 7, 2011
  5. Replies:
    2
    Views:
    1,470
Loading...

Share This Page