How to connect to the Dataflow backend database services
search cancel

How to connect to the Dataflow backend database services

book

Article ID: 379029

calendar_today

Updated On:

Products

VMware Tanzu Application Service VMware Spring Runtime

Issue/Introduction

The article provides the steps to identify and connect to the dataflow or skipper databases for a Spring Cloud Dataflow instance for Cloud Foundry. 

Environment

Tanzu Application Services

Spring Cloud Dataflow for Tanzu 

Resolution

Steps to connect to the backend databases in Cloud Foundry.

 

1. Login to Cloud foundry using cf CLI

 

2. Target the user org and space

cf target -o <ORG> -s <SPACE>

Sample:
$ cf target -o test -s test
API endpoint:   https://api.example.com
API version:    3.166.0
user: myuser
org: test
space: test

 

3. Get the guid of the spring cloud dataflow service

 

cf service <SCDF-INSTANCE> ---guid

Sample:
$ cf service mydf --guid
abcd****xyz

 

4. Target the backend org and space for the service instance. Backend applications are in p-dataflow ORG

 

cf target -o p-dataflow -s <SERVICE_INSTANCE_GUID>

Sample - Using the GUID from step #3

$ cf target -o p-dataflow -s abcd****xyz
API endpoint:   https://api.example.com
API version:    3.166.0
user:           myuser
org:            p-dataflow
space:          abcd****xyz

 


5. There are two database instance for dataflow namely

    • df-relational for dataflow db
    • skipper-relational for skipper db

Sample: List the services

$ cf services
Getting services in org p-dataflow / space abcd****xyz as myuser...
name                 service      plan       bound apps   last operation     broker                   upgrade available
df-messaging         p-rabbitmq   standard                create succeeded   p-rabbitmq
df-relational        p.mysql      db-small   dataflow     create succeeded   dedicated-mysql-broker   no
skipper-relational   p.mysql      db-small   skipper      create succeeded   dedicated-mysql-broker   no

 

6. Get the guid of the database you need to connect to


cf service <SERVICE_INSTANCE> --guid


Sample:
For Skipper db -  "skipper-relational"

$ cf service skipper-relational --guid
1234*****1234
Note: For Dataflow db use "df-relational"

 

7. Open another terminal and ssh to Ops Manager

 

8. ssh to the mysql service instance

bosh -d service-instance_<MYSQL_SERVICE_GUID>


Sample:
$ bosh -d service-instance_1234*****1234 ssh mysql/0
mysql/567***567:~$

 

6. Switch to sudo

sudo -i

 

7.  Locate the "mylogin.cnf" file using find command


find / -name mylogin.cnf


Sample:
$ find / -name mylogin.cnf
/var/vcap/data/jobs/mysql/76543**76543/config/mylogin.cnf

 

8. Start the mysql CLI

mysql --defaults-file=<PATH_OF_MYLOGIN_CNF_FILE>


Sample:
$ mysql --defaults-file=/var/vcap/data/jobs/mysql/76543**76543/config/mylogin.cnf


 

9. Target the mysql database


mysql > use service_instance_db

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed

 

10. You can now execute the sql commands