Bug 1383056 - mysql: command not found in rsh in OpenshiftOnline Nextgen Developer preview
Summary: mysql: command not found in rsh in OpenshiftOnline Nextgen Developer preview
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Image
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Vu Dinh
QA Contact: Bing Li
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-09 11:48 UTC by Kjartan Ivar Paulsen
Modified: 2016-10-24 16:14 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-10-24 16:14:08 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Kjartan Ivar Paulsen 2016-10-09 11:48:52 UTC
Description of problem:
It seems like mysql command is not available after logging on the mysql pod using oc rsh. See detailed steps below. 

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Following the step by step guide here for Mysql - https://docs.openshift.com/online/dev_guide/migrating_applications/database_applications.html

All good until the following step 6 - here are my last commands: 

$ oc rsh mysql-1-ukccw
cd /var/lib/mysql/data/mysqldump
mysql -u root
/bin/sh: line 2: mysql: command not found

Due to the above, next steps obviously also fails...
source ./all.sql
./all.sql: line 1: syntax error near unexpected token `('
./all.sql: line 1: `-- MySQL dump 10.13  Distrib 5.5.50, for Linux (x86_64)'
error: error executing remote command: error executing command in container: Error executing in Docker Container: 2



Actual results:
/bin/sh: line 2: mysql: command not found


Expected results:
Expected to be able to use mysql as root.

Additional info:

Comment 1 Ben Parees 2016-10-10 13:26:31 UTC
works using the current mysql 55 centos, sounds like something in online is out of date.

Comment 2 Vu Dinh 2016-10-10 17:33:35 UTC
Hi,

I'm unable to reproduce this issue for both mysql image for we have on PROD (5.5 and 5.6). I would like to ask QE to verify this.

Thanks,
Vu

Comment 3 Bing Li 2016-10-11 05:46:46 UTC
I can't reproduce this issue in PROD too, even using mysql:5.5 by modifying the template's parameter MYSQL_VERSION=5.5. The "mysql" command works fine:

# oc new-app mysql-persistent -p MYSQL_USER=test -p MYSQL_PASSWORD=test -p MYSQL_DATABASE=test

# oc get pod
NAME            READY     STATUS    RESTARTS   AGE
mysql-1-t5jt3   1/1       Running   0          3m

# oc rsh mysql-1-t5jt3
sh-4.2$ echo $PATH
/opt/rh/rh-mysql56/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
sh-4.2$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.6.32 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Comment 4 Vu Dinh 2016-10-11 12:52:24 UTC
Hi Kjartan,

We are unable to reproduce the issue that you reported. I would like to ask if you can give it another try and let us know if you still have the issue.

Thanks,
Vu

Comment 5 Kjartan Ivar Paulsen 2016-10-11 18:34:43 UTC
Hi Vu, 

I deleted all apps and the database and tried again. Here is the full command list, I got the same issue this time: 


$ oc  login --token=xxx --server=htt                                                        ps://api.preview.openshift.com
Logged into "https://api.preview.openshift.com:443" as "kipdev" using the to                                                        ken provided.

You have one project on this server: "ebcprod"

Using project "ebcprod".

$ ~
$ oc new-app mysql-persistent -p MYSQL_USER=adminQtEeZaf -p MYSQL_PASSWORD=u                                                        pkztXTj_ZU6 MYSQL_DATABASE=ebc
--> Deploying template "mysql-persistent" in project "openshift"

     mysql-persistent
     ---------
     MySQL database service, with persistent storage.  Scaling to more than                                                         one replica is not supported.  You must have persistent volumes available in                                                         your cluster to use this template.

     * With parameters:
        * Memory Limit=512Mi
        * Namespace=openshift
        * Database Service Name=mysql
        * MySQL User=xxx
        * MySQL Password=xxx
        * MySQL Database Name=sampledb
        * Volume Capacity=1Gi
        * Version of MySQL Image=5.6

--> Creating resources with label app=mysql-persistent ...
    service "mysql" created
    persistentvolumeclaim "mysql" created
    deploymentconfig "mysql" created
--> Success
    Run 'oc status' to view your app.

$ ~
$ oc get pods
NAME             READY     STATUS    RESTARTS   AGE
mysql-1-3zvj3    0/1       Pending   0          11s
mysql-1-deploy   1/1       Running   0          17s


$ ~
$ oc get pods
NAME            READY     STATUS    RESTARTS   AGE
mysql-1-3zvj3   1/1       Running   0          3m

$ oc rsync ./mysqldump mysql-1-3zvj3:/var/lib/mysql/data
Forwarding from 127.0.0.1:58789 -> 37621
Forwarding from [::1]:58789 -> 37621
Handling connection for 58789
sending incremental file list
mysqldump/
mysqldump/all.sql

sent 37642845 bytes  received 31 bytes  1234192.66 bytes/sec
total size is 37638144  speedup is 1.00

$ /c/Dev/ws
$ oc rsh mysql-1-3zvj3
cd /var/lib/mysql/data/mysqldump
ls
all.sql
mysql -u root
/bin/sh: line 3: mysql: command not found

Comment 6 Vu Dinh 2016-10-11 20:04:22 UTC
Hi Kjartan,

First of all, I'm really sorry that you keep having issue with the "mysql" command. Myself and another engineer did the exact same steps that you listed in the previous comment and everyone worked fine. So, we are still unable to reproduce the issue from our side.

I would like to ask if you have used IRC in the past as I would like to have a real-time chat with you to assist you with the issue further. You can go to freenode and join #openshift or #openshift-dev channels and we can chat. My IRC nick is vdinh and I'm in the office between 9AM to 4PM ET (Eastern Time US).

In the meantime, I would like to ask if you can run command "oc get is -n openshift) and provide me with the output. Furthermore, I want you to delete the project (if it is not an issue for you) and re-create it. Then, go through the normal steps that you've done before. Also, if you can just deploy the mysql pod and then "oc rsh" into the pod and run "mysql" command (skipping the whole oc rsync step), I wonder if you still experience the issue.

Thanks,
Vu

Comment 7 Kjartan Ivar Paulsen 2016-10-23 15:08:45 UTC
(In reply to Vu Dinh from comment #6)
> Hi Kjartan,
> 
> First of all, I'm really sorry that you keep having issue with the "mysql"
> command. Myself and another engineer did the exact same steps that you
> listed in the previous comment and everyone worked fine. So, we are still
> unable to reproduce the issue from our side.
> 
> I would like to ask if you have used IRC in the past as I would like to have
> a real-time chat with you to assist you with the issue further. You can go
> to freenode and join #openshift or #openshift-dev channels and we can chat.
> My IRC nick is vdinh and I'm in the office between 9AM to 4PM ET (Eastern
> Time US).
> 
> In the meantime, I would like to ask if you can run command "oc get is -n
> openshift) and provide me with the output. Furthermore, I want you to delete
> the project (if it is not an issue for you) and re-create it. Then, go
> through the normal steps that you've done before. Also, if you can just
> deploy the mysql pod and then "oc rsh" into the pod and run "mysql" command
> (skipping the whole oc rsync step), I wonder if you still experience the
> issue.
> 
> Thanks,
> Vu

Hi Vu, 

Sorry for late reply, got very busy for a while. Will try to recreate without syncing. Firstly, here is the result of "oc get is - n openshift" before doing anything more since last attempt: 

$ oc get is -n openshift
NAME                                  DOCKER REPO                                                                  TAGS                         UPDATED
dotnet                                172.30.47.227:5000/openshift/dotnet                                          latest,1.0                   2 days ago
jboss-eap64-openshift                 registry.ops.openshift.com/jboss-eap-6/eap64-openshift                       latest,1.4,1.3               2 days ago
jboss-eap70-openshift                 registry.ops.openshift.com/jboss-eap-7/eap70-openshift                       latest,1.4,1.3               2 days ago
jboss-webserver30-tomcat8-openshift   registry.ops.openshift.com/jboss-webserver-3/webserver30-tomcat8-openshift   latest,1.2,1.1               2 days ago
jenkins                               172.30.47.227:5000/openshift/jenkins                                         1,latest                     2 days ago
mariadb                               172.30.47.227:5000/openshift/mariadb                                         latest,10.1                  2 days ago
mongodb                               172.30.47.227:5000/openshift/mongodb                                         2.6,2.4,latest + 1 more...   2 days ago
mysql                                 172.30.47.227:5000/openshift/mysql                                           5.5,latest,5.6               2 days ago
nodejs                                172.30.47.227:5000/openshift/nodejs                                          latest,4,0.10                2 days ago
perl                                  172.30.47.227:5000/openshift/perl                                            latest,5.20,5.16             2 days ago
php                                   172.30.47.227:5000/openshift/php                                             latest,5.6,5.5               2 days ago
postgresql                            172.30.47.227:5000/openshift/postgresql                                      9.4,9.2,latest + 1 more...   2 days ago
python                                172.30.47.227:5000/openshift/python                                          latest,3.5,3.4 + 2 more...   2 days ago
redhat-sso70-openshift                registry.ops.openshift.com/redhat-sso-7/sso70-openshift                      latest,1.3,1.3-19            2 days ago
ruby                                  172.30.47.227:5000/openshift/ruby                                            2.0,latest,2.3 + 1 more...   2 days ago
wildfly                               172.30.47.227:5000/openshift/wildfly                                         latest,10.0                  2 days ago

Comment 8 Kjartan Ivar Paulsen 2016-10-23 15:41:39 UTC
Tried to recreate the project now. Only added mysql-persistent, no synching. Steps followed: 

$ oc delete project ebcprod
project "ebcprod" deleted

$ oc new-project ebcprod
Already on project "ebcprod" on server "https://api.preview.openshift.com:443".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git

to build a new example application in Ruby.

$ oc new-app mysql-persistent -p MYSQL_USER=... -p MYSQL_PASSWORD=... -p MYSQL_DATABASE=ebc
--> Deploying template "mysql-persistent" in project "openshift"

     mysql-persistent
     ---------
     MySQL database service, with persistent storage.  Scaling to more than one replica is not supported.  You must have persistent volumes available in your cluster to use this template.

     * With parameters:
        * Memory Limit=512Mi
        * Namespace=openshift
        * Database Service Name=mysql
        * MySQL User=...
        * MySQL Password=...
        * MySQL Database Name=ebc
        * Volume Capacity=1Gi
        * Version of MySQL Image=5.6

--> Creating resources with label app=mysql-persistent ...
    service "mysql" created
    persistentvolumeclaim "mysql" created
    deploymentconfig "mysql" created
--> Success
    Run 'oc status' to view your app.

$ oc get pods
NAME             READY     STATUS              RESTARTS   AGE
mysql-1-deploy   0/1       ContainerCreating   0          6s

$ oc get pods
NAME             READY     STATUS              RESTARTS   AGE
mysql-1-deploy   1/1       Running             0          17s
mysql-1-takv4    0/1       ContainerCreating   0          9s

$ oc get pods
NAME             READY     STATUS    RESTARTS   AGE
mysql-1-deploy   1/1       Running   0          27s
mysql-1-takv4    0/1       Running   0          19s

$ oc get pods
NAME            READY     STATUS    RESTARTS   AGE
mysql-1-takv4   1/1       Running   0          39s

$ oc rsh mysql-1-takv4
mysql
/bin/sh: line 1: mysql: command not found

Comment 9 Kjartan Ivar Paulsen 2016-10-23 16:48:41 UTC
I tested again now using cmd shell instead of Git Bash 64 for windows which I was using initially while testing this out first. 

With cmd shell it works just fine. Apparently Git Bash must have dropped some vital information while using RSH. This is how it looks from cmd shell. Notice the extra "sh-4.2$". This was missing while using GIT Bash 64. 

oc rsh mysql-1-takv4
sh-4.2$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 777
Server version: 5.6.32 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>


Thanks for your support and attempts to recreate. This was a good learning for me too, testing out with different shells is often a good idea when things are not working as they should.

Cheers
Kjartan

Comment 10 Kjartan Ivar Paulsen 2016-10-23 16:51:02 UTC
For your reference, this is the shell that seems to be incompatible with the CLI - 

https://git-scm.com/download/win

Comment 11 Vu Dinh 2016-10-24 16:14:08 UTC
Hey Kjartan,

Not a problem at all. I'm glad to know that the issue has been resolved on your side.

Thanks again for the information.

Vu


Note You need to log in before you can comment on or make changes to this bug.