This topic tells you how to migrate from a MySQL for PCF v1 database to a VMware SQL with MySQL for Tanzu Application Service v2.x database for your VMware Tanzu Service Broker for AWS.
If your Service Broker for AWS is configured to use the MySQL for PCF v1 tile, VMware recommends migrating your data to a VMware SQL with MySQL for Tanzu Application Service database.
Doing this migration reduces dependency on v1 as users move to v2, and prepares you to use TLS (encryption) for AWS services.
To complete a database migration, you must have the following:
The latest Cloud Foundry CLI
Cloud Foundry credentials to access the org and space of the Service Broker for AWS
You can use the MysqlTools plug-in to migrate your data.
Install the MysqlTools
plug-in using the following command:
cf install-plugin -f -r CF-Community "MysqlTools"
Verify that the plug-in is installed using the following command:
cf mysql-tools -h
Log in to your Cloud Foundry deployment:
cf api $YOUR_CLOUD_FOUNDRY_API
cf login
The broker is deployed in the system
org in the iaas-brokers
space.
Target this space and verify that you see the broker.
cf target -o system -s iaas-brokers
Expected output:
api endpoint: https://api.sys.my-domain.com api version: 2.94.0 user: admin org: system space: iaas-brokers
Check the state of the broker by running:
cf app MY-BROKER-NAME
For example:
$ cf app aws-services-broker Showing health and status for app aws-services-broker in org system / space iaas-brokers as admin... name: aws-services-broker requested state: started instances: 2/2 usage: 64M x 2 instances routes: aws-services-broker.sys.my-domain.com last uploaded: Wed 17 Jul 22:57:04 UTC 2024 stack: cflinuxfs3 buildpack: go_buildpack state since cpu memory disk logging cpu entitlement details #0 running 2024-07-17T22:57:22Z 0.0% 12.4M of 64M 47.4M of 1G 0B/s of 16K/s 2.4% #1 running 2024-07-17T22:57:22Z 0.0% 12.5M of 64M 47.4M of 1G 0B/s of 16K/s 2.4%
You might also see your MySQL for PCF v1 database instance bound to the broker.
cf services
Expected output:
Getting services in org system / space iaas-brokers as admin... name service plan bound apps last operation aws-broker-db p-mysql 100mb aws-services-broker create succeeded
After you verify the state of the broker, you can safely stop it and unbind the database.
Stop the broker:
cf stop MY-BROKER-NAME
For example:
$ cf stop aws-services-broker Stopping app aws-services-broker in org system / space iaas-brokers as admin... OK
Unbind the database from the broker:
cf unbind-service MY-BROKER-NAME SERVICE-INSTANCE-NAME
For example:
$ cf unbind-service aws-services-broker aws-broker-db
Follow these steps to migrate your data.
Determine which plan you want to use:
cf marketplace -s p.mysql
Expected output:
Getting service plan information for service p.mysql as admin... OK service plan description free or paid db-small This plan provides a small dedicated MySQL instance. free db-medium This plan provides a medium dedicated MySQL instance. free db-large This plan provides a large dedicated MySQL instance. free
Migrate your data by running:
cf mysql-tools migrate SERVICE-INSTANCE-NAME PLAN-TYPE
For example:
$ cf mysql-tools migrate aws-broker-db db-small 2018/06/06 09:11:53 Creating new service instance "aws-broker-db-new" for service p.mysql using plan db-small 2018/06/06 09:16:05 Unpacking assets for migration to /var/folders/qn/bxc0sm8j5dgcx260_4r3vr7w0000gn/T/migrate_app_335236385 2018/06/06 09:16:05 Started to push app Done uploading 2018/06/06 09:16:15 Successfully pushed app 2018/06/06 09:16:16 Successfully bound app to v1 instance 2018/06/06 09:16:18 Successfully bound app to v2 instance 2018/06/06 09:16:18 Starting migration app 2018/06/06 09:16:33 Started to run migration task 2018/06/06 09:16:37 Migration completed successfully
Note Take note of the Migration completed successfully
message in the above example. This is the best available indication that the migration was successful. This message does not appear if the migration process was not successful.
List the service instances by running:
cf services
The migration tool gives the old database the name SERVICE-INSTANCE-NAME-old
, for example:
$ cf services Getting services in org system / space iaas-brokers as admin... name service plan bound apps last operation aws-broker-db-old p-mysql 100mb update succeeded aws-broker-db p.mysql db-small update succeeded
After migrating your data, bind the new database to the broker.
Bind the new database to the broker:
cf bind-service MY-BROKER-NAME SERVICE-INSTANCE-NAME
For example:
$ cf bind-service aws-services-broker aws-broker-db Binding service aws-broker-db to app aws-services-broker in org system / space iaas-brokers as admin... OK
Start the broker:
cf start MY-BROKER-NAME
For example:
$ cf start aws-services-broker Starting app aws-services-broker in org system / space iaas-brokers as admin... Waiting for app to start... name: aws-services-broker requested state: started instances: 2/2 usage: 64M x 2 instances routes: aws-services-broker.my-domain.com last uploaded: Wed 17 Jul 22:57:04 UTC 2024 stack: cflinuxfs3 buildpack: go_buildpack start command: bin/aws-services-broker state since cpu memory disk logging cpu entitlement details #0 running 2024-07-17T22:57:22Z 0.0% 12.4M of 64M 47.4M of 1G 0B/s of 16K/s 2.4% #1 running 2024-07-17T22:57:22Z 0.0% 12.5M of 64M 47.4M of 1G 0B/s of 16K/s 2.4%
Before deleting the old database instance, confirm that the broker behaves correctly by creating some new AWS service instances. Try binding these services to the v2 database. (You can delete these service instances after running this test.)
After confirming that your data is migrated and the broker is running, delete the old database by running:
cf delete-service -f SERVICE-INSTANCE-NAME-old
For example:
$ cf delete-service -f aws-broker-db-old Deleting service aws-broker-db-old in org system / space iaas-brokers as admin... OK
Update the plan name in the Broker Config
section of your tile to be consistent with the changes you made during migration.