Copies files between multiple hosts at once.
gpscp { -f <hostfile_gpssh> | -h <hostname> [-h <hostname> ...] }
[-J <character>] [-v] [[<user>@]<hostname>:]<file_to_copy> [...]
[[<user>@]<hostname>:]<copy_to_path>
gpscp -?
gpscp --version
The gpscp
utility allows you to copy one or more files from the specified hosts to other specified hosts in one command using SCP (secure copy). For example, you can copy a file from the Greenplum Database master host to all of the segment hosts at the same time.
To specify the hosts involved in the SCP session, use the -f
option to specify a file containing a list of host names, or use the -h
option to name single host names on the command-line. At least one host name (-h
) or a host file (-f
) is required. The -J
option allows you to specify a single character to substitute for the hostname in the copy from
and copy to
destination strings. If -J
is not specified, the default substitution character is an equal sign (=
). For example, the following command will copy .bashrc
from the local host to /home/gpadmin
on all hosts named in hostfile_gpssh
:
gpscp -f hostfile_gpssh .bashrc =:/home/gpadmin
If a user name is not specified in the host list or with user@
in the file path, gpscp
will copy files as the currently logged in user. To determine the currently logged in user, do a whoami
command. By default, gpscp
goes to $HOME
of the session user on the remote hosts after login. To ensure the file is copied to the correct location on the remote hosts, it is recommended that you use absolute paths.
Before using gpscp
, you must have a trusted host setup between the hosts involved in the SCP session. You can use the utility gpssh-exkeys
to update the known host files and exchange public keys between hosts if you have not done so already.
Specifies the name of a file that contains a list of hosts that will participate in this SCP session. The syntax of the host file is one host per line as follows:
<<hostname>>
-h
option multiple times to specify multiple host names.
-J
option allows you to specify a single character to substitute for the hostname in the
copy from
and
copy to
destination strings. If
-J
is not specified, the default substitution character is an equal sign (
=
).
$HOME
of the session user. You can also use the equal sign '
=
' (or another character that you specify with the
-J
option) in place of a hostname. This will then substitute in each host name as specified in the supplied host file (
-f
) or with the
-h
option.
Copy the file named installer.tar
to /
on all the hosts in the file hostfile_gpssh
.
gpscp -f hostfile_gpssh installer.tar =:/
Copy the file named myfuncs.so to the specified location on the hosts named sdw1
and sdw2
:
gpscp -h sdw1 -h sdw2 myfuncs.so =:/usr/local/greenplum-db/lib