Postgres to mysql , portaldb migration fails
search cancel

Postgres to mysql , portaldb migration fails

book

Article ID: 222521

calendar_today

Updated On:

Products

CA API Developer Portal

Issue/Introduction

We are trying to migrate from a postgres db  to a mysql instance. 

We are following the steps provided in the documentation:

https://techdocs.broadcom.com/us/en/ca-enterprise-software/layer7-api-management/api-developer-portal/4-5/install-configure-and-upgrade/install-portal-on-docker-swarm/migrating-portal-data-from-postgresql-to-mysql.html 

The migration log shows no clue and all the json files contains 

Error: Internal server error: Resource VPC_SETTINGS_res is based on a table (vpc_settings) that no longer exists. To fix this problem, edit the resource and connect it with a valid table.

Environment

Release :

Component :

Resolution

You will get this error when the migration container can not connect to the postgress database which runs in portal_portaldb container.

if you use the default hostname  the connection will fail !    PostgreSQL hostname [default: portaldb]: 

This needs to be the IP of the host running the portal containers.

or 

You can use the alias name specified in step 2 to connect 

docker network connect --alias migrationdb migrationnetwork  <Postgres master container ID>

  1. Make the main portaldb externally accessible: docker service update --publish-add '5432:5432' portal_portaldb
  2. Create an new docker network: docker network create migrationnetwork
  3. Find the main contain id for primary postgres container: docker container ls | grep postgres
  4. Connect the primary postgres container to the new network:  docker network connect --alias=migrationdb migrationnetwork <Postgres master container ID>
  5. Run the upgrade container: docker run --rm -it -v migdb:/opt/store --network migrationnetwork  caapim/apim-portal-migration:5.0.cr1
    Input for the migration container:
    PostgreSQL hostname [default: portaldb]: migrationdb
    PostgreSQL port [default: 5432]: 5432
    PostgreSQL username [default admin]: admin
    PostgreSQL password [default 7layer]: 7layer
    Mysql hostname: <fqdn for mysql host>
    MySql port: 3306
    Mysql user name: portal_admin
    Mysql password: some_secret_password