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
- [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
- /Home/data: notaregularfile
So, you need to first compress the folder and then use the command to transfer data.
[Html] view plaincopy
- [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)
- <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
- Yuminstall-ynfs-utils
(2) modify the configuration file (create a shared file path)
[Plain] view plaincopy
- <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
- [Root @ localhostDesktop] #/etc/init. d/rpcbindstart # No response after entering this command
- [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
- 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
- Serviceiptablesstop
After the server is configured, check the shared directory.
(3) Client mount nfs
[Plain] view plaincopy
- Mount-tnfs192.168.1.102:/home/mnt/new_data