7

How to download or backup or to save a copy of a file from openshift remote folder into my local-system folder using rhc client tool? or is there any other way other than rhc client tool to make a backup of it to my local system?

Also, Is there a way to copy an entire folder from remote(openshift) to local?

  • I tried this one which helped me., rhc scp app_name download /path/to/local/folder /path/to/remote/folder/file., but how to download a folder –  Dec 31 '14 at 11:24

3 Answers3

13

First, tar and gzip your folder on the server within a ssh session, the syntax is:

rhc ssh <app_name>
tar czf <name_of_new_file>.tar.gz <name_of_directory>

Second, after you have disconnected from the openshift server (with CTRL-D), download this file to your local system:

rhc scp <app_name> download <local_destination> <absolute_path_to_remote_file>

Then on your local machine you can extract the file and perform your actions.

timo.rieber
  • 3,727
  • 3
  • 32
  • 47
  • For this "tar czf .tar.gz " –  Jan 01 '15 at 16:59
  • I am trying to run the first command in MongoDB pod on OpenShift with `tar czf my_dump.tar.gz dump` and it returns `tar: Old option `g' requires an argument.` I also tried `zip -r dump.zip dump` and got `zip: command not found`. – user1063287 Nov 19 '18 at 14:56
  • Actually, this works from pod terminal in OpenShift Online console: `tar czf my_dump.tar.gz dump`. – user1063287 Nov 19 '18 at 15:09
5

Use winscp (if on windows) to ssh into your openshift app. Navigate to your folder. Drag and drop folder or files to local machine.

Filezilla - using filezilla and sftp with openshift

fat fantasma
  • 7,483
  • 15
  • 48
  • 66
  • I use linux. i tried gigolo to connect the openshift remote file system but no sftp support and permission denied error when i click var folder. Is there anything like winscp for linux. –  Dec 31 '14 at 16:41
  • 1
    Try Filezilla on linux. – fat fantasma Dec 31 '14 at 18:50
  • I tried filezilla and also found a blog related to filezilla setting up with openshift.... works nice. It seems I accidentally uploaded some files through terminal ., able to view all, delete, retrieve files/folders. Thanks @fatfantasma. –  Jan 01 '15 at 04:59
2

теперь можно так

copy a pod directory to a local directory:

oc rsync <pod-name>:/opt/app-root/src /c/source

https://docs.okd.io/3.11/dev_guide/copy_files_to_container.html

Denis Orlov
  • 130
  • 4