Sonarqube数据迁移:从6.3社区版迁移至7.0社区版的简便方案咨询
Hey there, let's break down the most reliable, straightforward way to migrate your SonarQube instance from a 6.3 Community Edition server to another running 7.0 Community Edition. Since you didn't find what you needed in the analysis parameters docs, we'll focus on the core parts that hold your SonarQube data and configuration—no fancy tricks, just proven steps.
First: Understand the Version Gap
Critical note: You can't just take your 6.3 database and drop it straight into a 7.0 server. SonarQube changes its database schema between major/minor versions, so we need to handle the version upgrade either on the original server first, or on the target server. Let's cover both options, starting with the most recommended one.
Option 1: Upgrade First on Original Server, Then Migrate (Recommended)
This is safer because you can verify your data works on 7.0 before moving it to the new server.
Backup Everything on the Original 6.3 Server
- Stop the SonarQube service first—never backup a running instance!
- Backup your SonarQube database using your DB tool of choice:
- For PostgreSQL: Run
pg_dump sonarqube > sonarqube_backup.sql - For MySQL: Run
mysqldump -u [user] -p sonarqube > sonarqube_backup.sql
- For PostgreSQL: Run
- Copy the entire
conf/folder (holds yoursonar.propertiesconfigs) - Copy the
data/folder (Elasticsearch indexes, plugin caches) - Note down any third-party plugins you've installed—you'll need 7.0-compatible versions later.
Upgrade Original Server to 7.0
- Download SonarQube 7.0 Community Edition and unpack it into a new directory (don't overwrite your 6.3 installation!)
- Copy your backed-up
conf/sonar.propertiesinto the new 7.0conf/folder. Double-check the database connection settings are correct. - Clear the 7.0
plugins/folder, then add only:- The 7.0-compatible versions of your third-party plugins (check the SonarQube Marketplace for compatible releases)
- Do not copy plugins from your 6.3 installation—use the ones bundled with 7.0 for core features.
- Start the new 7.0 SonarQube service. Watch the logs—SonarQube will automatically upgrade the database schema. Wait until the service fully starts.
- Verify everything works: Check that all your projects, metrics, and history are intact.
Migrate to the Target Server
- Stop the 7.0 service on the original server, then take a fresh backup of the upgraded database.
- On the target server: Install SonarQube 7.0 Community Edition (same exact version as the upgraded original).
- Create a new empty database on the target server, with the same user/permissions as the original.
- Restore the fresh 7.0 database backup into this new target database.
- Copy the
conf/folder from the original 7.0 installation to the target server's 7.0conf/folder, updating the database connection to point to the target DB. - Copy the
data/andplugins/folders from the original 7.0 installation to the target server (replace the default ones). - Start the target server's SonarQube service. Check the logs for errors, then access the web UI to confirm all your projects and data are there.
Option 2: Upgrade Directly on the Target Server (If Original Can't Be Upgraded)
If you can't touch the original server, you can do the upgrade on the target instead.
Backup Original 6.3 Data
- Stop the original 6.3 service, then backup the database,
conf/,data/, andplugins/as described in Option 1.
- Stop the original 6.3 service, then backup the database,
Set Up 6.3 on Target Server
- Install SonarQube 6.3 Community Edition on the target server (match the original version exactly).
- Restore the original 6.3 database backup to a new database on the target.
- Copy the backed-up
conf/,data/, andplugins/to the target's 6.3 installation. - Start the 6.3 service, verify all your data loads correctly.
Upgrade Target Server to 7.0
- Stop the 6.3 service, backup the current database and files again.
- Unpack SonarQube 7.0 into a new directory on the target.
- Copy the 6.3
conf/sonar.propertiesto the 7.0conf/folder, update the database connection. - Clear the 7.0
plugins/folder, add only 7.0-compatible plugins (core ones from 7.0 bundle + updated third-party plugins). - Start the 7.0 service, let it auto-upgrade the database schema.
- Verify everything works once the service is up.
Key Things to Double-Check
- Database Compatibility: SonarQube 7.0 requires specific DB versions (e.g., MySQL 5.6+, PostgreSQL 9.3+). Make sure your target server's database meets these requirements.
- Permissions: Ensure the SonarQube run user has read/write access to the
conf/,data/,logs/, andtemp/folders on the target server. - Elasticsearch: Don't skip copying the
data/folder after upgrading to 7.0—6.3's Elasticsearch indexes won't work with 7.0's built-in ES version. - Plugin Checks: Some older plugins might not support 7.0. If a plugin breaks, remove it temporarily or find an updated version.
内容的提问来源于stack exchange,提问作者mohan

