Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the implementation of data transfer between CVM ECS

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you what is the implementation of data transmission between cloud servers ECS. I hope you will gain a lot after reading this article. Let's discuss it together.

Implementation of data transfer between ECS of CVM

Brief introduction

Today, with the rapid development of information technology, the server will exchange a large number of file data with other stand-alone computers every day, and file transfer is common for everyone. Therefore, its importance is self-evident. File transfer methods are different, choose a suitable file transfer tool, in the work can get twice the result with half the effort. Save resources, facilitate transmission, improve work efficiency, encryption protection and so on. Therefore, many file transfer tools emerge as the times require, such as: NC, FTP, SCP, NFS, SAMBA, RSYNC/SERVERSYNC and so on, each has its own characteristics. This article will first briefly introduce the basic principles of file transfer, and then introduce in detail the common file transfer methods on unix/linux and windows platforms, and compare them according to their respective characteristics, so that readers can have a more detailed understanding of the file transfer mode, so that they can choose the appropriate file transfer mode according to different needs.

File transfer principle

File transfer is a form of information transmission, which is the process of transferring file data between data source and data destination, also known as file data communication. The operating system extracts the file data into memory for temporary storage, and then copies it to the destination. Encryption means that a shell is added to the file, and the file itself is still a whole. The copy only transfers the whole to other places and does not need to be decrypted. Decryption is required only when the compressed package is opened. As a whole, it is impossible for a large file to be transferred from one host to another in an instant. Transfer is a continuous process, but it is not a division of the file. Therefore, if the file is accidentally interrupted during the transfer, there will be no transferred files in the destination path. In addition, if multiple files are transferred, these files are transferred sequentially, if interrupted in the middle. The file being transferred fails, but the previously completed file transfer is successful (if you are transferring a file package, it is treated as a file no matter how many files are in it).

Usually we see NC, FTP, SCP, NFS, and so on, are tools that can be used to transfer file data. Below, we will describe in detail the characteristics and usage of the main file transfer tools.

NETCAT

In the network tools, there is the reputation of "Swiss Army knife", it is powerful, as a network tool, its ability to transfer files should not be underestimated.

Common parameters:

Examples of simple usage

1. Port scan 21-24 (take IP192.168.2.34 as an example).

Nc-v-w 2 192.168.2.34-z 21-24nc: connect to 192.168.2.34 port 21 (tcp) failed: Connection refusedConnection to 192.168.2.34 22 port [tcp/ssh] succeeded roomnc: connect to 192.168.2.34 port 23 (tcp) failed: Connection refusednc: connect to 192.168.2.34 port 24 (tcp) failed: Connection refused

two。 Copy the file from 192.168.2.33 to 192.168.2.34.

On 192.168.2.34:

Nc-l 1234 > test.txt

On 192.168.2.33:

Nc 192.168.2.34

< test.txt 3.用nc命令操作memcached。 存储数据: printf "set key 0 10 6rnresultrn" |nc 192.168.2.34 11211 获取数据: printf "get keyrn" |nc 192.168.2.34 11211 删除数据: printf "delete keyrn" |nc 192.168.2.34 11211 查看状态: printf "statsrn" |nc 192.168.2.34 11211 模拟top命令查看状态: watch "echo stats" |nc 192.168.2.34 11211 清空缓存: printf "flush_allrn" |nc 192.168.2.34 11211 #谨慎操作,清空了缓存就没了 SCP(安全拷贝 secure copy) 介绍 SCP 命令的用法和 RCP 命令格式非常类似,区别就是 SCP 提供更安全保障,SCP 在需要进行验证时会要求你输入密码或口令,一般推荐使用 SCP 命令,因为它比 RCP 更安全。SCP 命令使用 SSH 来传输数据,并使用与 SSH 相同的认证模式,提供同样的安全保障,SSH 是目前较可靠得,为远程登录会话和其他网络服务提供安全性的协议,利用 SSH 协议可以有效防止远程管理过程中的信息泄露问题。SCP 是基于 SSH 的应用,所以进行数据传输的机器上必须支持 SSH 服务。 特点 SCP 类似于RCP, 它能够保留一个特定文件系统上的文件属性,能够保留文件属性或者需要递归的拷贝子目录。 SCP它具备更好文件传输保密性。与此同时,付出的代价就是文件传输时需要输入密码而且涉及到 SSH 的一些配置问题,这些都影响其使用的方便性,对于有特定需求的用户,是比较合适的传输工具。 常用示例 使用 SCP 命令,需要输入密码,如果不想每次都输入,可以通过配置 SSH,这样在两台机器间拷贝文件时不需要每次都输入用户名和密码: 生成 RSA 类型的密钥: 上述命令生成 RSA 类型的密钥。在提示密钥的保存路径和密码时,可以直接回车使用默认路径和空密码。这样,生成的公共密钥保存/.ssh/id_rsa.pub,私有密钥保存在 /.ssh/id_rsa 。然后把这个密钥对中的公共密钥的内容复制到要访问的机器上的 /.ssh/authorized_keys 文件中。这样,下次再访问那台机器时,就不用输入密码了。 scp可以在 2个 linux 主机间复制文件 命令基本格式: scp [可选参数] file_source file_target 从本地复制到远程(如下四种方式): scp local_file remote_username@remote_ip:remote_folderscp local_file remote_username@remote_ip:remote_filescp local_file remote_ip:remote_folderscp local_file remote_ip:remote_file 注:第1,2个指定了用户名,命令执行后需要再输入密码,第1个仅指定了远程的目录,文件名字不变,第2个指定了文件名。 第3,4个没有指定用户名,命令执行后需要输入用户名和密码,第3个仅指定了远程的目录,文件名字不变,第4个指定了文件名。 从远程复制到本地: 注:从远程复制到本地,只要将从本地复制到远程的命令的后2个参数 调换顺序 即可 scp root@www.cumt.edu.cn:/home/root/others/music /home/space/music/i.mp3scp -r www.cumt.edu.cn:/home/root/others/ /home/space/music/Rsync Rsync是linux/Unix文件同步和传送工具。用于替代rcp的一个工具,rsync可以通过rsh或ssh使用,也能以daemon模式去运行,在以daemon方式运行时rsync server会开一个873端口,等待客户端去连接。连接时rsync server会检查口令是否相符,若通过口令查核,则可以通过进行文件传输,第一次连通完成时,会把整份文件传输一次,以后则就只需进行增量备份。 安装方式: 注:可以使用每个发行版本自带的安装包管理器安装。 sudo apt-get install rsync #在debian、ubuntu 等在线安装方法;slackpkg install rsync #Slackware 软件包在线安装;yum install rsync #Fedora、Redhat 等系统安装方法; 源码编译安装: wget http://rsync.samba.org/ftp/rsync/src/rsync-3.0.9.tar.gztar xf rsync-3.0.9.tar.gzcd rsync-3.0.9./configure && make && make install 参数介绍:

Rsync operates in six different modes:

1. Copy the local files and copy the files in the / home/coremail directory to the / cmbak directory.

Rsync-avSH / home/coremail/ / cmbak/

two。 Copy the contents of the local machine to the remote machine.

Rsync-av / home/coremail/ 192.168.11.12:/home/coremail/

3. Copy the contents of the remote machine to the local machine.

Rsync-av 192.168.11.11:/home/coremail/ / home/coremail/

4. Copy the files from the remote rsync server (running rsync as daemon) to the local machine.

Rsync-av root@172.16.78.192::www / databack

5. Copy the local machine files to the remote rsync server (running rsync as daemon). This mode is started when the DST path information contains the "::" delimiter.

Rsync-av / databack root@172.16.78.192::www

6. Displays a list of files for the remote machine. This is similar to rsync transport, except that the local machine information is omitted from the command.

Rsync-v rsync://192.168.11.11/data

Rsync profile description:

Cat/etc/rsyncd.conf # content is as follows: port = 873 # Port number uid = nobody # specifies that the daemon process UIDgid = nobody # when the module transfers files specifies that the daemon process GIDuse chroot = no # uses chroot to transfer files to a directory in the file system Max connections = 10 # maximum number of concurrent connections strict modes = yes # specify whether to check the permissions of password files pid file = / usr/local/rsyncd/rsyncd.pid # specify PID files lock file = / usr/local/rsyncd/rsyncd.lock # specify lock files that support max connection The default is / var/run/rsyncd.lockmotd file = / usr/local/rsyncd/rsyncd.motd # that defines the server information Write the contents of the rsyncd.motd file log file = / usr/local/rsyncd/rsync.log # rsync server log log format =% t% a% m% f% bsyslog facility = local3timeout = 300 [conf] # Custom module path = / usr/local/nginx/conf # used to specify the directory to be backed up comment = Nginx confignore errors # you can ignore some IO errors read only = no # set no The client can upload files, yes is read-only write only = no # no for the client to download, yes cannot download hosts allow = 192.168.2.0 / 24 # connectable IPhosts deny = * # disallowed connection IPlist = false # when requested by the customer Use the module list uid = rootgid = rootauth users = backup # to connect the user name and have nothing to do with the linux system user name secrets file = / etc/rsyncd.pass # verify the password file after reading this article, I believe you have a certain understanding of the implementation of data transmission between CVM ECS, want to know more related knowledge, welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report