Migrating SonarQube Database from Internal PostgreSQL to AWS RDS PostgreSQL

Hi SonarQube Community,

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

*Current SonarQube Version: 7.9 SonarQube Community Edition
*Current Database: Internal PostgreSQL 12
*Target Database: AWS RDS PostgreSQL 13
*New SonarQube Instance: 9.9 SonarQube 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 database. Once the migration is complete, I intend to connect the new SonarQube 9.9 instance to this AWS RDS PostgreSQL 13 database.

Steps I Have Taken:

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

Issues Faced:

  • Schema Mismatch Error: I encountered a schema mismatch error, and SonarQube 9.9 is not starting.
  • Unable to See Data: I am not able to see any of the migrated data.

Questions:

  • Are there specific compatibility issues or steps I may have missed when migrating from SonarQube 7.9 with PostgreSQL 12 to SonarQube 9.9 with PostgreSQL 13?
  • What are the recommended steps to resolve the schema mismatch error?
  • Are there any best practices for using pg_dump and restoring SonarQube databases, particularly when moving between versions
  • And then what about the SonarQube DB Copy Tool is suitable for this scenario. DB Copy Tool is free or paid one. SonarQube database copy tool
  • Determining the server upgrade path | SonarQube Docs what is the process for this step.

Thank you!
Martin Luther

Hey @martinluther. Welcome to our community!

We do support PostgreSQL from 11 to 15, so you shouldn’t have any issues there.

Regarding the best practices for upgrading PostgreSQL, you should check their official documentation.

The SonarQube DB Copy Tool is meant for the case you were moving from PostgreSQL to Oracle or MSSQL.

As for the error you are getting, could you post your logs?

Without looking at your logs, only at your post, I understood that you are attempting to migrate from SonarQube 7.9 straight to 9.9. That won’t work. In the page that you linked, if you scroll a bit more, you are going to find some migration path examples, one of which is the migration from 7.9 LTA to 9.9 LTA: 7.9 LTA > 8.9 LTA > 9.9 LTA (one intermediary step).

So what I would try is:

  • Starting with the restored DB into AWS RDS PostgreSQL 13
  • Configure SonarQube 7.9 to use it and ensure that the PostgreSQL upgrade worked
  • Upgrade SonarQube to 8.9
  • Upgrade SonarQube to 9.9

After the last upgrade, please review our post upgrade steps.

HTH

Hi @davi.vidal,

Thanks for your reply,

I have upgraded SonarQube from version 7.9 to 8.9, and I can see all the projects. However, I am unable to see any plugins in version 8.9.

I found the following message regarding the Marketplace: “Plugins available in the Marketplace are not provided or supported by SonarSource. Please reach out directly to their maintainers for support.”

After that, I proceeded with the upgrade from version 8.9 to 9.9, but now I am unable to see the projects, and I get a popup message as shown in the screenshot below.

Could you please help me resolve this issue?

Now i’m roll back to 8.9.

Thanks,
Martin

Are there any errors in the logs when you try to see your projects?

sonarqube_web.log (860.3 KB)
sonarqube_es.log (14.2 KB)
sonarqube_ce.log (3.9 KB)
sonarqube_app (1).log (10.2 KB)



This is SonarQube version 9.9. I’m not able to see the project and issues. However, in the third screenshot, I can see the project, but I’m not able to find any plugins. Where can I get the upgraded plugins?

Hey @martinluther

Try trashing your /data/es8 folder of your SonarQube install directory and restarting.

If you still face an issue, I’d like to know what happens when you click on one of the projects in the Projects Management area.

Do you see project data, or get a permissions issue?

1 Like

Hi @Colin ,

Thanks for your help @Colin ,

Now, I can see the projects and issues, but I’m unable to find the plugin. Where can I find the plugins? I tried looking in the marketplace but couldn’t find them.

Thanks
Martin

This post should explain things:

1 Like

Thank you @Colin

Hello,

I am encountering an issue when running a Jenkins pipeline that involves SonarQube analysis. The job is failing on a Jenkins slave machine that runs Java 8. Below is the error message:

vbnet

Copy code

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar (default-cli) on project BillDeskIntegrationService: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar failed: Unable to load the mojo 'sonar' in the plugin 'org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/sonarsource/scanner/maven/SonarQubeMojo has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

The error indicates that the Sonar Maven plugin requires Java 11 (class file version 55.0), but the Jenkins slave is running Java 8, which only supports class file versions up to 52.0.

I am hesitant to upgrade the entire Jenkins slave to Java 11 because it may introduce compatibility issues with other Maven builds that are dependent on Java 8.

Additionally, I have another Jenkins slave with both Java 8 and Java 11 installed. Is there a way to configure my Jenkins pipeline or Maven job to dynamically select the appropriate Java version based on the tool (e.g., Java 11 for SonarQube analysis and Java 8 for other parts of the build)?

I would appreciate any advice on how to resolve this issue without disrupting the current setup.

Thanks in advance!

@martinluther Please feel free to raise a new thread.