02月14日,2022

redhat系列下centos 使用scp命令拷贝两台服务器数据

最近介入的中国移动下的一个APP开发项目,之前是在移动机房是centos8,现在因业务需要,迁移到成都的移动机房是移动根据redhat改的big enterprise得服务器!直接下载再上传太慢且麻烦,选用的是ssh到新服务器,然后scp登录到老开发app服务器上拷贝到新服务器,通过scp的命令执行,快速、方便!

1.安卓scp

 yum install -y openssh-clients
2.命令参数介绍
[root@localhost ~]# scp -h
unknown option -- h
usage: scp [-12346BCpqrv] [-c cipher 使用压缩] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port 选择端口] [-S program] 【-r 复制目录】【-v 显示进度,比如查看链接、认证或配置错误】
           [[user@]host1:]file1 ... [[user@]host2:]file2
3.命令示例
[root@zgxwfz-01 ~]#  scp -rv -P 9094 root@211.xxx.xxx.156:/www/backup/site/web_test.liaonian.org_20220214_013001.tar.gz  /www/backup/site
Executing: program /usr/bin/ssh host 211.xxx.xx.156, user root, command scp -v -r -f /www/backup/site/web_test.liaonian.org_20220214_013001.tar.gz
OpenSSH_8.0p1, OpenSSL 1.1.1c FIPS  28 May 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: configuration requests final Match pass
debug1: re-parsing configuration
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: Connecting to 211.xxx.xx.156 [211.xxx.xxx.156] port 9094.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.0
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to 211.139.26.156:9094 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes256-ctr MAC: hmac-sha1 compression: none
debug1: kex: client->server cipher: aes256-ctr MAC: hmac-sha1 compression: none
debug1: kex: curve25519-sha256 need=32 dh_need=32
debug1: kex: curve25519-sha256 need=32 dh_need=32
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:jHixnhrl7OscX5alOarMHL4anUyv61H1I+nmIl2k1Js
debug1: Host '[211.xxx.xxx.156]:9094' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: Will attempt key: /root/.ssh/id_rsa
debug1: Will attempt key: /root/.ssh/id_dsa
debug1: Will attempt key: /root/.ssh/id_ecdsa
debug1: Will attempt key: /root/.ssh/id_ed25519
debug1: Will attempt key: /root/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: KCM:)
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available (default cache: KCM:)
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Trying private key: /root/.ssh/id_xmss
debug1: Next authentication method: password
root@211.xxx.xxx.156's password:
debug1: Authentication succeeded (password).
Authenticated to 211.xxx.xxx.156 ([211.xxx.xxx.156]:9094).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: scp -v -r -f /www/backup/site/web_test.liaonian.org_20220214_013001.tar.gz
Sending file modes: C0644 3522303705 web_liaonian.com.cn_20220214_013001.tar.gz
Sink: C0644 3522303705 web_test.lliaonian.com.cn_20220214_013001.tar.gz
web_liaonian.com.cn_20220214_013001.tar.gz                                                                                                                                                                        11%  399MB 816.8KB/s 1:01:51 ETA
至此结束!


本文链接:https://www.liaonian.com.cn/info_14.html

-- EOF --