Search code examples
postgresqlsonarqubedevopsamazon-rdsdatabase-migration

Issue Migrating SonarQube Database from aws Internal PostgreSQL to AWS RDS PostgreSQL


I am currently upgrading my SonarQube setup and migrating its database. Here’s my current configuration:

Current SonarQube Version: 7.9 (Community Edition)
Current Database: Internal PostgreSQL 12
Target Database: AWS RDS PostgreSQL 13
New SonarQube Instance: 9.9 (Community Edition)

Objective:

I want to migrate the existing data from the internal PostgreSQL 12 database (used by SonarQube 7.9) to an AWS RDS PostgreSQL 13 instance. After migrating the database, I intend to connect it to a new SonarQube 9.9 instance.

Steps I Have Taken:

  • Data Export Using pg_dump: I used pg_dump to export the data from the internal PostgreSQL 12 database.
  • Restore Data to AWS RDS PostgreSQL 13: I restored the pg_dump output to the AWS RDS PostgreSQL 13 instance.
  • Configure SonarQube 9.9 to Use the Restored Database: I updated the sonar.properties file in the SonarQube 9.9 instance to point to the AWS RDS PostgreSQL 13 database.
  • Start the New SonarQube 9.9 Instance: After configuring the connection settings, I attempted to start the SonarQube 9.9 instance.

Issues Faced:

  • Schema Mismatch Error: The SonarQube 9.9 instance is not starting due to a schema mismatch error.
  • Unable to See Data: None of the migrated data is visible in the new SonarQube instance.

Questions:

  • Compatibility Issues: Are there any known compatibility issues or specific steps I may have missed when migrating from SonarQube 7.9 with PostgreSQL 12 to SonarQube 9.9 with PostgreSQL 13?
  • Resolving Schema Mismatch Errors: What are the recommended steps to resolve schema mismatch errors when upgrading SonarQube versions and migrating databases?
  • Best Practices for Using pg_dump with SonarQube Databases: Are there any best practices or specific commands I should use when using pg_dump for SonarQube database migrations, especially between different SonarQube versions?
  • SonarQube DB Copy Tool: Would the SonarQube DB Copy Tool be suitable for this scenario? Is this tool free or does it require a license?
  • Upgrade Path Guidance: I found some information about "Determining the server upgrade path" in the SonarQube Docs. Can someone explain the process for this or provide guidance on how to correctly upgrade SonarQube versions while migrating databases?

Any advice or guidance on how to overcome these challenges would be greatly appreciated!

Thank you!

Martin Luther


Solution

  • There is no direct migration from 7.9 to 9.9. So you need to migrate from 7.9.1 → 8.9.10 and then from 8.9.10 → 9.9

    The pd_dump and restor is used just for copying the database, the migration is handled by the new version but there's some manual operations to do after migration (rebuild indexes, drop unused columns ....)