Migrating MySQL Data from Version 5.4.1 Untethered Mode to Version 5.5.0 Untethered Mode

You can migrate MySQL data from the cluster created in an older version of API Management - Local Edition.

The following section gives the procedure to migrate MySQL data for the following versions and modes of API Management - Local Edition.
  • 5.3.1 to 5.5.0 (untethered)
  • 5.4.1 to 5.5.0 (untethered)

Procedure

  1. Dump MySQL Data from the cluster created in the 5.4.1 version.
    1. Login to any tml-sql pod running in the 5.4.1 cluster.
      kubectl exec -it mysql-set-0-0 -- /bin/bash
    2. Run the following command to dump MySQL data. Update the MySQL password for the cluster.
      mysqldump --no-create-info --complete-insert --single-transaction -u root - p'changeme' \
        --ignore-table=masherysolar.area_config --ignore-table=masherysolar.areas \ 
        --ignore-table=masherysolar.package_key_audit_log --setgtid-purged=OFF masherysolar \
        > /tmp/mash541_data.sql
      Note: In case duplication of data occurs then redo the MySQL data dump by ignoring the duplicate entries. The following are few cases where duplication of entries is observed.
      • masherysolar.member_activity_log
      • masherysolar.member_audit_log
      • masherysolar.member_role_audit_log
      • masherysolar.method_override_audit_log
      • masherysolar.migration_log
    3. Copy the MySQL data file to the host.
      kubectl cp mysql-set-0-0:/tmp/mash531_data.sql mash541_data.sql
  2. Copy the MySQL data dumped from the 5.4.1 cluster to the 5.5.0 cluster.
    kubectl cp mash541_data.sql mysql-set-0-0:/tmp
  3. Clear the MySQL data in the 5.5.0 cluster.
    1. In the 5.5.0 cluster, login to thetml-sql pod where the MySQL data file was copied.
      kubectl exec -it mysql-set-0-0 -- /bin/bash
      
      
    2. Run the following command to clear data in MySQL.
      mysql -u root -p'changeme' -Nse 'show tables' masherysolar \
      | sed -r 's/\b(area_config|areas|package_key_audit_log)\b//g' \
      | sed '/^$/d' | while read table; do mysql -u root -p'changeme' \
      -e "truncate table $table" masherysolar; done
  4. Import MySQL data dumped from the 5.4.1 cluster to the 5.5.0 cluster.

    In the tml-sql pod where the MySQL data file is copied, run the following command to import the MySQL data dumped from the 5.4.1 cluster to the 5.5.0 cluster.

    mysql -u root -p'changeme' masherysolar < /tmp/mash541_data.sql
  5. Enable revert function.

    In the tml-sql pod run the following commands to enable revert function.

    cd /opt/mashery/containeragent/resources/sql/scripts
    ./sql-upgrade.sh 5.4.1
  6. Refresh cache of the 5.5.0 cluster.

    Login to each of the tml-cache pods of the 5.5.0 cluster and run the following command to refresh the cache.

    /opt/javaproxy/proxy/cacheloader --service --mapi --devclass --packager \
    --httpsclientsecurity --env production --verbose