Database Migration Between Two Different Region RDS

Hello everyone, I have encountered the following problem: My plan was to create a new EC2 instance and migrate my Sonarqube database, which is currently running on RDS, and upgrade Sonarqube from version 8.6 to the latest version.

Our current Sonarqube environment has the following specifications:

  • Developer edition
  • Version 8.6
  • The database is hosted on RDS in the AWS Sydney region.
  • Sonarqube service is running on Fargate, and everything is functioning correctly.

We decided to upgrade Sonarqube to the latest version along with the plugins. Here are the steps I took for the upgrade process:

  1. I created a new Sonarqube service with version 8.6 Community Edition on an EC2 instance using Docker. This EC2 instance is located in the Ohio region.
  2. I created a new RDS database in the Ohio region.
  3. I modified my Docker file to connect to the new empty database for the Sonarqube service.
  4. I successfully started the service, and I could access the frontend.

Next, I attempted to migrate the database from the Sydney region to the Ohio region:

  1. I exported the entire database from the target database using the following command:
pg_dump -Fc -h alex-sonarqube-db-instance-0-cluster.cluster-cveglago2fub.us-east-2.rds.amazonaws.com -U sonarqube -d sonarqube -f source_db_backup.dump

I imported the database into the RDS database located in the Ohio region using the following command:

pg_restore -v -h sonarqube.cluster-cveglago2fub.us-east-2.rds.amazonaws.com -U sonarqube -d sonarqube -1 source_db_backup.dump

However, after starting my Sonarqube Docker again, it got stuck during the boot process:

2024.01.22 15:56:16 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2024.01.22 15:56:16 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /opt/java/openjdk/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.17.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process11601799272907548695properties```

Do you have any idea?

Hey there.

Great that you’re getting up-to-date on SonarQube versions. :slight_smile:

How long did you let it run after it got “stuck”?

If I remember correctly, SonarQube v8.6 still does some indexing of the database data in the web process (which can take a while) before moving on. This should logged in the web.log file.

It might also be worth checking the DB-side to see if there are active connections reading data

Thank you for the reply Colin.

My Docker started 46 hours ago, so I have let it run for more than 45 hours:

root@ip-10-135-89-82:~# docker ps
CONTAINER ID   IMAGE                     COMMAND                  CREATED        STATUS        PORTS                                       NAMES
7f7a23f599be   sonarqube:8.6-community   "sh -c 'wget -O /opt…"   46 hours ago   Up 46 hours   0.0.0.0:9000->9000/tcp, :::9000->9000/tcp   root-sonarqube-1