How to upgrade MySQL service instances individually if there are no broker changes.
search cancel

How to upgrade MySQL service instances individually if there are no broker changes.

book

Article ID: 293323

calendar_today

Updated On:

Products

VMware Tanzu SQL VMware Tanzu for MySQL

Issue/Introduction

Starting with Tanzu for MySQL on Cloud Foundry 2.8, you can upgrade MySQL service instances individually. This is usually done with the command cf upgrade-service SERVICE_INSTANCE

However, in some scenarios, the above command returns: "No upgrade available". This happens in the event that there is no change made to the actual plan config, but you may still want to upgrade individual service instances. (For example, a cert rotation or stemcell change in which you want to upgrade instances one by one).

Resolution

The following are the steps to upgrade a single service instance:

  1. Get the GUID for the service instance to upgrade:
    $ cf service <service> --guid
    4378b86e-62a6-4858-8337-195c2af366bc
  2. SSH into the MySQL service broker VM and get the broker credentials:
    $ bosh -d <pivotal-mysql-deployment> ssh
    $ sudo -i
    $ egrep "username|password" /var/vcap/jobs/broker/config/broker.yml
      username: broker
      password: <password>
  3. From the service broker VM, use curl to get information about the service instances. We are looking for the Service Instance ID for the instance we want to upgrade, as well as the associated plan ID. The command format is: "curl -k -u <brokerUsername>:<brokerPassword> https://localhost:8080/mgmt/service_instances".
    $ curl -k -u broker:<password> https://localhost:8080/mgmt/service_instances
    [{"service_instance_id":"7c48e439-cc1d-4a12-ba59-5043f24e909b","plan_id":"07cf3296-b8e3-4c6b-8d74-b11a89599627"},{"service_instance_id":"4378b86e-62a6-4858-8337-195c2af366bc","plan_id":"07cf3296-b8e3-4c6b-8d74-b11a89599627"}]
  4. Given the service instance GUID and the service plan GUID, issue another curl command to update that specific service instance. The command format is "curl -k -vv -X PATCH -u <brokerUsername>:<brokerPassword> https://localhost:8080/mgmt/service_instances/<serviceInstanceGUID>?operation_type=upgrade -d '{ "plan_id": "servicePlanGUID" }'".
    $ curl -k -vv -X PATCH -u broker:<password> https://localhost:8080/mgmt/service_instances/4378b86e-62a6-4858-8337-195c2af366bc?operation_type=upgrade -d '{ "plan_id": "07cf3296-b8e3-4c6b-8d74-b11a89599627" }'
    *   Trying 127.0.0.1...
    * Connected to localhost (127.0.0.1) port 8080 (#0)
    * Server auth using Basic with user 'broker'
    > PATCH /mgmt/service_instances/4378b86e-62a6-4858-8337-195c2af366bc?operation_type=upgrade HTTP/1.1
    > Host: localhost:8080
    > Authorization: Basic YnJva2VyOmJ6MmFRdzd6bk9ja2ZMZ0RlRzRqajFwY2VkZFgxSi1C
    > User-Agent: curl/7.47.0
    > Accept: */*
    > Content-Length: 53
    > Content-Type: application/x-www-form-urlencoded
    > 
    * upload completely sent off: 53 out of 53 bytes
    < HTTP/1.1 202 Accepted
    < Date: Tue, 12 May 2020 19:25:46 GMT
    < Content-Length: 144
    < Content-Type: text/plain; charset=utf-8
    < 
    {"BoshTaskID":6564,"BoshContextID":"cede1fba-7986-42c9-9515-3796d189f638","OperationType":"upgrade","PostDeployErrand":{},"PreDeleteErrand":{}}
    * Connection #0 to host localhost left intact
    


This gives you the BoshTaskID, which you can monitor with bosh task <id>. After the associated BOSH task completes, the service instance should be upgraded.