Transfer files between two centos servers

Source: Internet
Author: User

Transfer files between two centos servers

Recently read data in CentOS (host. Because host A only reads data, the specific Deep Learning experiment needs to be performed in host B (CentOS) and data on host A needs to be transmitted. Because host A is not always on the CentOS system, and the data volume is relatively (40 Gb +), the method of using the USB copy is A bit unrealistic. After searching for information, we found two methods.

Note: Both hosts are CentOS 6.5 systems. host a: IP 192.168.1.102 host B: 192.168.1.33

1. Use command line

SSH on A and B allows root logon. The IP address of host B is 192.168.1.33. You need to transfer the/home/data folder on host A to host B and run the command

[Html] view plaincopy
  1. [Root @ localhostDesktop] # scp/home/dataroot@192.168.1.33:/home/new-data

In the above command,/home/data is the folder to be passed in host A, and the information following it is the information of host B.

If you enter the above command, you will be prompted to enter the root password of host B. For the folder to be uploaded, the scp command is not allowed.

[Html] view plaincopy
  1. /Home/data: notaregularfile

So, you need to first compress the folder and then use the command to transfer data.

[Html] view plaincopy
  1. [Root @ localhostDesktop] # create a .tar.bz2 file in tarjcvf/home/data.tar.bz2/home/dataworks with a high compression ratio (due to the large data volume, the compression time is relatively long)
  2. <Spanstyle = "font-size: 24px; "> </span> <prename =" code "class =" html "> <prename =" code "class =" html "> unzip root@localhost?top=#tar-xvjfdata.tar.bz2#decompress the .tar.bz2 File

 
 

2. NFS

First, let's take a look at NFS.

Network File System (NFS) is a Network File System that allows computers in the Network to share resources through TCP/IP networks. In NFS applications, local NFS client applications can transparently read and write files on the remote NFS server, just like accessing local files.

Next, let's take a look at the specific configuration process of the NFS server and client.

Server Configuration

(1) packages required for installing nfs, nfs-utils and rpcbind. Note: rpcbind will be installed when nfs-utils is installed in some centos versions.

[Plain] view plaincopy
  1. Yuminstall-ynfs-utils

(2) modify the configuration file (create a shared file path)

[Plain] view plaincopy
  1. <Prename = "code" class = "html"> [root @ localhostDesktop] # vim/etc/exports
/Home/192.168.1.0/24 (rw, all_squash) # content added to the file

 

The/home/directory to be shared is 192.168.1.0/24, which is the host that can be accessed. It can be an IP address or a network segment. () Is the share permission, where rw is the read and write, all_squash is the normal user identity

(3) After modification, start the NFS service

[Html] view plaincopy
  1. [Root @ localhostDesktop] #/etc/init. d/rpcbindstart # No response after entering this command
  2. [Root @ localhostDesktop] #/etc/init. d/nfsstart


Client configuration (host B)

(1) install the software package required for nfs (same as the installation method for the server)

(2) view the directories shared by the server

[Html] view plaincopy
  1. Showmount-e192.168.1.102

The following error is prompted:

Search for the problem on the Internet and find it is a problem with the fire prevention refer to the website NFS error: clnt_create: RPC: Port mapper failure-Unable to receive: errno 113 (No route to host)

No rules are added to the firewall on the accessed NFS server. What I do is to disable the firewall directly.

[Html] view plaincopy
  1. Serviceiptablesstop

After the server is configured, check the shared directory.

(3) Client mount nfs

[Plain] view plaincopy
  1. Mount-tnfs192.168.1.102:/home/mnt/new_data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.