Derek
Derek

Reputation: 9

Redhat Openshift 4 - Not able to make mysql connection from php pod to mysql pod

I am user of Openshift online and OKD. I am facing similar issue in both places. Please have a look.

  1. I have created a project.
  2. I have launched php in Developer's Catalog option. With other details, I entered my project's git url, project is cloned successfully. Now it needs to connect to mysql database only.
  3. In Pods, I deployed mysql image from 'Deploy Image' option. It is launched successfully.
  4. When I make mysql connection from php pod to mysql pod, it does not connect, connection time out. How should I make connection?

Note : I do not have datastore option to launch mysql from developer's catalog in openshift online, that's why I am launching mysql image from deploy image.

Upvotes: 0

Views: 508

Answers (1)

LinuXamination
LinuXamination

Reputation: 11

As you mentioned you are using Openshift Online and OKD and you are facing the issue at both places.

You can not create mysql from development store because currently, the OpenShift Online catalog does not provide MySQL template via the web interface directly, but you can deploy the MySQL template using the oc CLI instead. The database deployment is simplified when using templates.

Once logged in with the oc CLI, running

oc new-app -L

will list all of the templates that we were used to seeing in the web console, including the mysql-persistent. Then, you can specify all the template parameters via the oc CLI, e.g.:

oc new-app mysql-persistent -p MYSQL_USER=<desired_DB_username> -p MYSQL_PASSWORD=<mysql_password> -p MYSQL_DATABASE=<desired_database_name>

If you'd like to see all the supported template parameters, you can use

oc process <template_name> --parameters -n openshift 

or, for a more detailed output,

oc describe template <template_name> -n openshift

Once the app is launched successfully, you can find this app's hostname in services and connect to it from your php pod after defining host name in php configuration file.

Upvotes: 1

Related Questions