问题
I am trying to understand PCF concepts and thinking that once i am done with creating mysql services in PCF, how i can manage that database like creating tables and maintaining that table just like we do in pur traditional environment using mySqldeveoper. I came across one service like PivotalMySQLWeb and tried but didnt liked it much. So if somehow i can get connection details of mysql service , i can use that to connect using sql developer.
回答1:
The links @khalid mentioned are definitely good.
http://docs.pivotal.io/p-mysql/2-0/use.html https://github.com/andreasf/cf-mysql-plugin#usage
More generally, you can use an SSH tunnel to access any service, not just MySQL. This also allows you to use whatever tool you would like to access the service.
This is documented here, but if for some reason that goes away here are the steps.
- Create your target service instance, if you don't have one already.
- Push an app, any app. It really doesn't matter, it can be a hello world app. The app doesn't even need to use the service. We just need something to connect to.
- Either Bind the service from #1 to the app in #2 or create a service key using the service from #1. If you bind to the app, run
cf env <app>
or if you use a service key runcf service-key MY-DB EXTERNAL-ACCESS-KEY
and either one will give you your service credentials. - Run
cf ssh -L 63306:us-cdbr-iron-east-01.p-mysql.net:3306 YOUR-HOST-APP
, where63306
is the local port you'll connect to on your machine andus-cdbr-iron-east-01.p-mysql.net:3306
are the host and port from the credentials in step #3. - The tunnel is now up, use whatever client you'd like to connect to your service. For example:
mysql -u b5136e448be920 -h localhost -p -D ad_b2fca6t49704585d -P 63306
, whereb5136e448be920
andad_b2fca6t49704585d
are the username and database name from step #3 and 63306 is the local port you picked from step #4.
来源:https://stackoverflow.com/questions/49313213/how-to-setup-mysql-develper-for-pcf-mysql-database-to-manage-it