Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to move data between two VPS
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to move data between two VPS

aliletalilet Member

How can I move data from one VPS to another? I have two VirMach VPS and wants to move data from /var/www.

Bonus points if I can also setup a cron job using that method to move data periodically.

Comments

  • bdlbdl Member

    rsync

  • JordJord Moderator, Host Rep
    edited May 2020

    rsync

    Thanked by 1bdl
  • KeeparKeepar Member

    I use a manual method, to do such tasks, first compress them on .tar then download them to the second server with wget command

    I know it is not practical but its the fastest and the easiest in my opinion

  • aliletalilet Member
    edited May 2020

    Both push and pull for rsync are not working. The SSH port of both servers is 11941 and I am connected to both of them but neither push nor pull is working. In both cases I am getting connection timed out error.

    PULL

    rsync -e 'ssh -p 11941' [email protected]:/var/www/mywordpress/html/license.txt /home/mywordpressdata/
    ssh: connect to host xxx.xxx.xxx.xxx port 11941: Connection timed out
    rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
    rsync error: unexplained error (code 255) at io.c(235) [Receiver=3.1.2]
    

    PUSH

    rsync -e 'ssh -p 11941' /var/www/mywordpress/html/license.txt [email protected]:/home/mywordpressdata
    ssh: connect to host xxx.xxx.xxx.xxx port 11941: Connection timed out
    rsync: connection unexpectedly closed (0 bytes received so far) [sender]
    rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.2]
    

    ufw is installed on both servers and port 11941 is allowed for INCOMING connections.

    EDIT

    Ok I fixed the issue. I had to also allow OUTGOING connection on port 11941. But now I am getting a different error:

    rsync: mkstemp "/home/mywordpressdata/.license.txt.WtBOyf" failed: Permission denied (13)
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]  
    

    EDIT

    Ok logging in as root fixed the issue. Even though I was using sudo it was not working but using root worked.

  • For small size data transfer ive used scp many times and works like a charm

  • Webdock_ioWebdock_io Member, Host Rep
    edited July 2020

    Another way if the content in /var/www is accessible with a web server is to simply zip up the data and then fetch it on the other end - we use this method a lot when migrating websites - so you would do something like:

    # cd /var/www
    # zip -r mysite.zip .
    

    Maybe do a mysql dump first if you need that data as well

    Then on the remote, simply do

    # wget https://mysite.com/mysite.zip

    And then unzip mysite.zip

    Set ownership and permissions with chown and possibly chmod depending on the environment and you are good to go.

    We have an article on this on our site, which may provide more context:

    https://webdock.io/en/docs/wordpress-guides/migrating-wordpress-site-webdock

    Thanked by 1debaser
  • nbnnbn Member
    edited July 2020

    sshpass + scp + -r recursive on the home folder (or * on whatever folder you're trying to transfer). Bam. Also cron-able, I have tons of cron scripts on nexusbytes VPS using this exact model to hourly transfer data.

    Use these tags to prevent hostkey checking prompting to make scp automatic:
    scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null

    Something like this is easy if you don't mind having your password in the script. Otherwise you can create a file and read it from there, but this is easiest:
    sshpass -p 'mypassword' scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null /home/mylocalfolder/* [email protected]:/root/mydestfolder

  • you can use rsync or scp command to move data between to VPS servers on Linux.
    or you can take backup of your data and then put backup data file in another VPS that is another way to move data.

  • @cloudminister said:
    you can use rsync or scp command to move data between to VPS servers on Linux.
    or you can take backup of your data and then put backup data file in another VPS that is another way to move data.

    How are you not banned yet?

  • @SCAM_DONT_BUY said:

    @cloudminister said:
    you can use rsync or scp command to move data between to VPS servers on Linux.
    or you can take backup of your data and then put backup data file in another VPS that is another way to move data.

    How are you not banned yet?

    What?

  • raindog308raindog308 Administrator, Veteran

    @Keepar said: I use a manual method, to do such tasks, first compress them on .tar then download them to the second server with wget command

    I know it is not practical but its the fastest and the easiest in my opinion

    rsync is easier

    @Webdock_io said: # zip -r mysite.zip .

    rsync is easier

    Also, with rsync, if the copy is interrupted for any reason, you can rerun the command and it will pick up where it left off. Then methods you two advocate would start over from the beginning.

  • HostingbotHostingbot Member, Host Rep

    @raindog308 said:

    @Keepar said: I use a manual method, to do such tasks, first compress them on .tar then download them to the second server with wget command

    I know it is not practical but its the fastest and the easiest in my opinion

    rsync is easier

    @Webdock_io said: # zip -r mysite.zip .

    rsync is easier

    Also, with rsync, if the copy is interrupted for any reason, you can rerun the command and it will pick up where it left off. Then methods you two advocate would start over from the beginning.

    Agreed, just use rsync. Don't need to overcomplicate things XD

  • Webdock_ioWebdock_io Member, Host Rep

    @Hostingbot said:

    @raindog308 said:

    @Keepar said: I use a manual method, to do such tasks, first compress them on .tar then download them to the second server with wget command

    I know it is not practical but its the fastest and the easiest in my opinion

    rsync is easier

    @Webdock_io said: # zip -r mysite.zip .

    rsync is easier

    Also, with rsync, if the copy is interrupted for any reason, you can rerun the command and it will pick up where it left off. Then methods you two advocate would start over from the beginning.

    Agreed, just use rsync. Don't need to overcomplicate things XD

    Some would argue rsync is rather complicated and isn't "easy" until you actually learn how the tool works. Powerful, flexible, well-documented and very popular tool to be sure, but it's not entirely straightforward for someone who hasn't worked with it before.

    Zipping/tar'ing up all your files and then downloading that one file is conceptually simple, gets the job done nicely and safely, and is easy for a noob to do. I fail to see the benefit of rsync over this approach as a single-file transfer makes rsyncs resume capabilities practically a moot point.

  • rclone with sftp remote.

  • I recently used https://mover.io/ to move a whole bunch of stuff. There is an option for non-commercial services, see https://api.mover.io/v2/connectors/Agent/auth?side=source&locationSupported=true.

  • HostingbotHostingbot Member, Host Rep

    @Webdock_io said:

    @Hostingbot said:

    @raindog308 said:

    @Keepar said: I use a manual method, to do such tasks, first compress them on .tar then download them to the second server with wget command

    I know it is not practical but its the fastest and the easiest in my opinion

    rsync is easier

    @Webdock_io said: # zip -r mysite.zip .

    rsync is easier

    Also, with rsync, if the copy is interrupted for any reason, you can rerun the command and it will pick up where it left off. Then methods you two advocate would start over from the beginning.

    Agreed, just use rsync. Don't need to overcomplicate things XD

    Some would argue rsync is rather complicated and isn't "easy" until you actually learn how the tool works. Powerful, flexible, well-documented and very popular tool to be sure, but it's not entirely straightforward for someone who hasn't worked with it before.

    Zipping/tar'ing up all your files and then downloading that one file is conceptually simple, gets the job done nicely and safely, and is easy for a noob to do. I fail to see the benefit of rsync over this approach as a single-file transfer makes rsyncs resume capabilities practically a moot point.

    Fair point, however, most people are too lazy to zip/tar their own files then manually move it. Rsync is fairly simple to use and there is plenty of documentation on Google to get even a "noob" moving on it. But yes, everyone has their own approach.

  • LittleCreekLittleCreek Member, Patron Provider

    rsync is NOT complicated for a server administrator.

Sign In or Register to comment.