Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Copy the files between servers

by ramuks123 (Initiate)
on May 20, 2013 at 13:01 UTC ( [id://1034334]=perlquestion: print w/replies, xml ) Need Help??

ramuks123 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Copy the files between servers
by marto (Cardinal) on May 20, 2013 at 13:05 UTC
Re: Copy the files between servers
by Arunbear (Prior) on May 20, 2013 at 13:44 UTC
Re: Copy the files between servers
by ww (Archbishop) on May 20, 2013 at 15:48 UTC
Re: Copy the files between servers
by Anneq (Vicar) on May 20, 2013 at 19:19 UTC

    Install SSH servers and clients on both server hosts. Then use a CPAN module like Net::SCP or others to securely copy files between servers.

    For even more powerful functiontality, consider using git, which supports SSH. There are CPAN modules available that have practically already written the perl code for you.

    I have never used one of these modules myself yet, though they look very well documented and easy to use.

    I have used rsync, which Arunbear suggested, in the past and it worked well.

    Now I usually set up password-less SSH on each server and then use git or scp from the command-line.

    To setup password-less SSH (after you have installed an SSH client and server on both hosts):

    $ cd ~/.ssh $ ssh-keygen -t rsa

    You will be prompted to enter a filename in which to save the key (~/.ssh/id_rsa): <thishost>on<targethost>

    $ ssh-copy-id -i <thishost>on<targethost>.pub <targethost>

    or for Macs or other OSs which do not have ssh-copy-id:

    <targethost>$ cd ~/.ssh <targethost>$ ssh <thishost> cat ~/.ssh/<thishost>on<targethost>.pub +>> authorized_keys

    Test SSH with Identity Key:

    $ ssh -i ~/.ssh/<thishost>on<targethost> <targethost>

    Lastly, create file ~/.ssh/config

    Host <targethost> Hostname <targethost> StrictHostKeyChecking no User <Your username> IdentityFile ~/.ssh/<thishost>on<targethost>

    The beauty of the config file is, I can ssh into any one of my hosts or mobile devices, regardless of OS, without providing username or password. CAUTION: You MUST carefully protect access to any host on which you use password-less SSH.

    UPDATE:

    Several years ago I used Sparkleshare to sync between desktop hosts/servers, in conjunction with rsync on iOS devices (jailbroken), to keep personal files synchronized. It worked pretty much OK back then. You might want to check it out if your files in question are larger than what Dropbox or iCloud. etc. can handle or if git is not suitable.

    Anne

Re: Copy the files between servers
by fisher (Priest) on May 20, 2013 at 13:03 UTC
    what you have done?
Re: Copy the files between servers
by vinoth.ree (Monsignor) on May 21, 2013 at 06:30 UTC
    Arunbear ++

    I use rsync method to copy image files between production server to backup server. Its the best method i have seen so for.


    All is well

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1034334]
Approved by vinoth.ree
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-19 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found