跳转至

seabox scp

seabox scp

不同host之间或者组件实例级的文件拷贝

语法

``` bash seabox scp [OPTIONS]

Options: -v, –verbose verbose mode -r recursively copy entire directories -h, –host TEXT ssh host to connect to (multiple host is okay with a comma-separated list)

-f, –file TEXT a file listing all hosts to connect to -c, –coordinator specify all coordinator hosts to connect to -e, –executor specify all executor hosts to connect to -s, –scdcs specify all scdcs hosts to connect to -m, –monitor specify all monitor hosts to connect to -a, –all specify all seabox modules hosts to connect to -S, –source TEXT source file ([[user@]host1:]file is okay) -D, –dest TEXT destination file path –ignore-bad-hosts ignore hosts on which SSH were unsuccessful –instance scp in instance mode when specify modules -?, –help show this help, then exit ```

描述

不同host之间或者组件实例级的文件拷贝

  • 注意:如有注意事项,补充
选项

该命令支持选项说明如下:

Options

命令支持的选项

-v, --verbose
使用该选项时表示输出更加详细的打印信息
-r
使用该选项时表示递归复制整个目录
-h, --host
使用该选项时表示指定要连接的host,后面跟host名称,多个host以,隔开
-f, --file
使用该选项时表示指定列出所有要连接的host的文件,后面跟文件名称
-c, --coordinator
使用该选项时表示指定连接集群中所有coordinator节点的host
-e, --executor
使用该选项时表示指定连接集群中所有executor节点的host
-s, --scdcs
使用该选项时表示指定连接集群中所有scdcs节点的host
-m, --monitor
使用该选项时表示指定连接集群中所有monitor节点的host
-a, --all
使用该选项时表示指定连接集群中所有组件(不包括gtm)的host
-S, --source
使用该选项时表示指定要拷贝的源文件,后面跟源文件名称,支持[[user@]host1:]file的格式
-D, --dest
使用该选项时表示指定接受拷贝的目的路径,后面跟目的路径
--ignore-bad-hosts
使用该选项时表示忽略SSH未成功的host
--instance
使用该选项时表示以实例模式进行拷贝,需要与-a/-c/-e/-m/-s选项组合使用。若不指定–dest,则默认拷贝到对应组件实例的数据目录下。若指定–dest(相对路径),则会拷贝到对应组件实例的数据目录/dest下。
-?, --help
使用该选项时返回seabox scp命令的帮助信息
注解

如有具体的使用限制及注意事项,在这部分列出。

  • 注1:seabox scp命令对选项的组合使用有严格限制,若输入的不支持的选项组合,则会报错退出。支持的选项组合说明如下:

    seabox scp -S <source_file> { -h <hostname> | -f <hostfile> | -a | -c | -e | -m | -s } [-D <dest_path>] [--instance] [--ignore-bad-hosts] [-r] [-v]
    

当指定-h或者-f时,同时指定–instance,会报错退出;未指定–instance时,同时不指定–dest,报错退出

  • 注2: seabox scp命令要求使用SeaboxMPP数据库集群安装用户seabox,或root用户,且需通过以下命令设置正确的环境变量:
source $SDHOME/seaboxmpp_path.sh

其中,$SDHOME为安装SeaboxMPP数据库服务的主目录。

示例

以下是seabox scp --help的执行结果:

[seabox@mpp-test-1 bin]$ seabox scp --help
seabox scp to multiple hosts or module instances at once.

Usage: 
  seabox scp [OPTIONS]

Options:
  -v, --verbose       verbose mode
  -r                  recursively copy entire directories
  -h, --host TEXT     ssh host to connect to (multiple host is okay with a
                      comma-separated list)

  -f, --file TEXT     a file listing all hosts to connect to
  -c, --coordinator   specify all coordinator hosts to connect to
  -e, --executor      specify all executor hosts to connect to
  -s, --scdcs         specify all scdcs hosts to connect to
  -m, --monitor       specify all monitor hosts to connect to
  -a, --all           specify all seabox modules hosts to connect to
  -S, --source TEXT   source file ([[user@]host1:]file is okay)
  -D, --dest TEXT     destination file path
  --ignore-bad-hosts  ignore hosts on which SSH were unsuccessful
  --instance          scp in instance mode when specify modules
  -?, --help          show this help, then exit

以下命令可将文件tmp拷贝到指定host:sy1

[seabox@sy1 ~]$ seabox scp -S tmp -h sy1 -D /home/seabox -v
2022-07-07 07:38:05 UTC [12466] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" tmp sy1:/home/seabox
tmp                                                                                                                                                100%    0     0.0KB/s   00:00    
2022-07-07 07:38:05 UTC [12466] scscp default INFO: completed successfully

以下命令可将文件tmp拷贝到集群executor所在的所有host上

[seabox@sy1 ~]$ seabox scp -S tmp -e -D /home/seabox -v
2022-07-07 07:37:16 UTC [12156] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" tmp sy1:/home/seabox
2022-07-07 07:37:16 UTC [12156] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" tmp sy2:/home/seabox
tmp                                                                                                                                                100%    0     0.0KB/s   00:00    
tmp                                                                                                                                                100%    0     0.0KB/s   00:00    
2022-07-07 07:37:16 UTC [12156] scscp default INFO: completed successfully

以下命令可将文件aaa拷贝到集群coordiantor各个实例的数据目录下

[seabox@sy1 ~]$ seabox scp -S aaa -c --instance -v
2022-07-07 07:33:57 UTC [11066] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" aaa sy1:/home/seabox/mpp/data/coordinatordd/0
aaa                                                                                                                                                100%    0     0.0KB/s   00:00    
2022-07-07 07:33:57 UTC [11066] scscp default INFO: completed successfully

以下命令可将文件aaa拷贝到集群executor各个实例的数据目录/tmp目录下

[seabox@sy1 ~]$ seabox scp -S aaa -e --dest tmp --instance -v
2022-07-07 07:34:58 UTC [11379] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" aaa sy2:/home/seabox/mpp/data/executordd/mirror/0/2/tmp
aaa                                                                                                                                                100%    0     0.0KB/s   00:00    
2022-07-07 07:34:58 UTC [11379] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" aaa sy1:/home/seabox/mpp/data/executordd/mirror/0/3/tmp
aaa                                                                                                                                                100%    0     0.0KB/s   00:00    
2022-07-07 07:34:58 UTC [11379] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" aaa sy1:/home/seabox/mpp/data/executordd/mirror/0/4/tmp
aaa                                                                                                                                                100%    0     0.0KB/s   00:00    
2022-07-07 07:34:58 UTC [11379] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" aaa sy1:/home/seabox/mpp/data/executordd/mirror/0/5/tmp
aaa                                                                                                                                                100%    0     0.0KB/s   00:00    

......

2022-07-07 07:34:59 UTC [11379] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" aaa sy2:/home/seabox/mpp/data/executordd/primary/5/tmp
aaa                                                                                                                                                100%    0     0.0KB/s   00:00    
2022-07-07 07:34:59 UTC [11379] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" aaa sy2:/home/seabox/mpp/data/executordd/mirror/0/0/tmp
aaa                                                                                                                                                100%    0     0.0KB/s   00:00    
2022-07-07 07:35:00 UTC [11379] scscp default INFO: scp -o "BatchMode yes" -o "StrictHostKeyChecking no" aaa sy2:/home/seabox/mpp/data/executordd/mirror/0/1/tmp
aaa                                                                                                                                                100%    0     0.0KB/s   00:00    
2022-07-07 07:35:00 UTC [11379] scscp default INFO: completed successfully
相关命令