1

I have installed oc and login openshift on my linux pc. When i running

oc rsh mysql-55-centos7-1-1aa3 ls -al /tmp/
total 72428
drwxrwxrwt. 1 root       root       35 Oct 30 00:38 .
drwxr-xr-x. 1 root       root       39 Oct 23 23:53 ..
drwxrwxrwt. 2 root       root        6 Nov  2  2016 .ICE-unix
drwxrwxrwt. 2 root       root        6 Nov  2  2016 .Test-unix
drwxrwxrwt. 2 root       root        6 Nov  2  2016 .X11-unix
drwxrwxrwt. 2 root       root        6 Nov  2  2016 .XIM-unix
drwxrwxrwt. 2 root       root        6 Nov  2  2016 .font-unix
-rwx------. 1 root       root      827 Nov  2  2016 ks-script-la2kM
-rwxr-xr-x. 1 1063070000 root  3343400 Oct 24 04:08 mysql

it works, but

oc rsh mysql-55-centos7-1-1aa3 mysqldump -h1.1.1.1 -uuser -ppassword data1 > /tmp/data1.sql

command terminated with exit code 126

it doesn't work

oc rsh mysql-55-centos7-1-1aa3 mysqldump

rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\\"mysqldump\\\": executable file not found in $PATH\"\n"

command terminated with exit code 126

How to solve the problem ?

mohan08p
  • 5,002
  • 1
  • 28
  • 36
Kim
  • 11
  • 2
  • Consider using port forwarding to expose the MySQL database port on your local machine and run ``mysqldump`` on local computer. For details on port forwarding see the interactive tutorial about it at https://learn.openshift.com – Graham Dumpleton Oct 30 '17 at 01:19
  • The reason ``mysqldump`` can't be found may be because a shell session isn't being created and so SCL package for MySQL is not being activated. Thus ``mysqldump`` not in ``PATH``. – Graham Dumpleton Oct 30 '17 at 01:21

1 Answers1

3

I hat the same problem with postgres.

I got it working with:

oc rsh MY_POD /bin/sh -i -c 'pg_dump'

scl_enable gets activated this way. (/bin/sh -i -c ...)

S-Man
  • 22,521
  • 7
  • 40
  • 63
Thomas Herzog
  • 506
  • 2
  • 6
  • The reason it needs to be done this way is that PostgreSQL is likely provided by a SCL package and that has to enabled, which sets up ``PATH`` and access to any shared libraries. The way the image is set up is that the enabling of PostgreSQL is done as side effect of shell initialisation. When using ``oc rsh`` to run program direct, there is no shell. When do it using ``bash -c``, there is. – Graham Dumpleton Mar 21 '18 at 22:41