Sonarqube 6.7.1 to 7.9.1 with DB migration from mysql to postgresql

Sonarqube 6.7.1 with MySql
Upgrade To
Sonarqube 6.7.1 with PostgreSql
Upgrade To
Sonarqube 7.9.1 with PostgreSql

Migration to Postgresql is OK, but upgration to 7.9.1 got this:
2019.12.08 21:14:36 INFO web[org.sonar.INFO] Security realm started
2019.12.08 21:14:36 WARN web[o.s.a.s.w.WebService$Action] The response example is not set on action api/plugins/download
2019.12.08 21:14:36 WARN web[o.s.a.s.w.WebService$Action] The response example is not set on action api/permissions/search_templates
2019.12.08 21:14:36 INFO web[o.s.s.t.TelemetryDaemon] Sharing of SonarQube statistics is enabled.
2019.12.08 21:14:36 INFO web[o.s.s.n.NotificationDaemon] Notification service started (delay 60 sec.)
2019.12.08 21:14:36 INFO web[o.s.s.s.GeneratePluginIndex] Generate scanner plugin index
2019.12.08 21:14:36 INFO web[o.s.s.s.RegisterPlugins] Register plugins
2019.12.08 21:14:36 ERROR web[o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalStateException: Default organization with uuid ‘AW7ko_Zanyo54cSbimhF’ does not exist
at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
at org.sonar.server.organization.DefaultOrganizationProviderImpl.getDefaultOrganization(DefaultOrganizationProviderImpl.java:56)
at org.sonar.server.organization.DefaultOrganizationProviderImpl.get(DefaultOrganizationProviderImpl.java:48)
at org.sonar.server.organization.DefaultOrganizationEnforcer.start(DefaultOrganizationEnforcer.java:34)
at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
at org.sonar.server.platform.platformlevel.PlatformLevelStartup.access$001(PlatformLevelStartup.java:47)
at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(PlatformLevelStartup.java:83)
at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:46)
at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(PlatformLevelStartup.java:80)
at org.sonar.server.platform.Platform.executeStartupTasks(Platform.java:196)
at org.sonar.server.platform.Platform.access$400(Platform.java:46)
at org.sonar.server.platform.Platform$1.lambda$doRun$1(Platform.java:121)
at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
at org.sonar.server.platform.Platform$1.doRun(Platform.java:121)
at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
at java.base/java.lang.Thread.run(Thread.java:834)
2019.12.08 21:14:36 INFO web[o.s.p.ProcessEntryPoint] Hard stopping process
2019.12.08 21:14:37 WARN web[o.s.p.ProcessEntryPoint$HardStopperThread] Can not stop in 1000ms
2019.12.08 21:15:44 WARN web[o.a.c.u.SessionIdGeneratorBase] Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [71,428] milliseconds.
2019.12.08 21:15:44 INFO web[o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.ws.WebServiceFilter@53ace67d [pattern=UrlPattern{inclusions=[/api/system/migrate_db., …], exclusions=[/api/properties, …]}]
2019.12.08 21:15:44 INFO web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2019.12.08 21:15:44 INFO web[o.s.s.n.NotificationDaemon] Notification service stopped
2019.12.08 21:15:44 WARN web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [Thread-2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@11.0.3/java.net.SocketInputStream.socketRead0(Native Method)
java.base@11.0.3/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)
java.base@11.0.3/java.net.SocketInputStream.read(SocketInputStream.java:168)
java.base@11.0.3/java.net.SocketInputStream.read(SocketInputStream.java:140)

I check organizations TABLE , uuid is still the old one.

Hello,
Have you used the mysql-migrator tool to migrate from MySQL to Postgres ?
If so, are you 100% sure that the migration went well ? do you still have the logs ?
Alex.

I tried several times . But due to a large database , migration need to run about 1 hour . Then terminal will timeout. I will try migration again.

Indeed it is a prerequisite to have a properly migrated database before running the upgrade.
Can you describe how you proceeded to migrate from MySql to Postgres ?

[root@foreman bin]# /usr/share/sonarqube-6.7.1-pg/bin/linux-x86-64/sonar.sh start^C
[root@foreman bin]# vi target.properties
[root@foreman bin]# ./mysql-migrator -source source.properties -target target.properties
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table organizations …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table organization_members …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table groups_users …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table rules_parameters …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table rules_profiles …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table org_qprofiles …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table default_qprofiles …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table project_qprofiles …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table qprofile_edit_users …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table qprofile_edit_groups …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table groups …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table snapshots …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table group_roles …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table rule_repositories …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table rules …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table rules_metadata …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table events …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table quality_gates …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table quality_gate_conditions …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table properties …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table project_links …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table duplications_index …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table project_measures …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table internal_properties …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table projects …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table manual_measures …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table active_rules …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table notifications …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table user_roles …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table active_rule_parameters …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table users …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table metrics …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table loaded_templates …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table issues …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table issue_changes …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table permission_templates …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table perm_tpl_characteristics …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table perm_templates_users …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table perm_templates_groups …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table qprofile_changes …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table file_sources …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table ce_queue …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table ce_activity …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table ce_task_characteristics …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table ce_task_input …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table ce_scanner_context …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table user_tokens …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table webhook_deliveries …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table es_queue …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table plugins …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table project_branches …
[main] INFO org.sonarsource.sqdbmigrator.migrator.ContentCopier - copying table analysis_properties …
Tables Records Seconds


organizations 1 0.0
organization_members 12 0.0
groups_users 18 0.0
rules_parameters 843 0.3
rules_profiles 23 0.0
org_qprofiles 23 0.0
default_qprofiles 16 0.0
project_qprofiles 0 0.0
qprofile_edit_users 0 0.0
qprofile_edit_groups 0 0.0
groups 3 0.0
snapshots 683 0.2
group_roles 121 0.0
rule_repositories 17 0.0
rules 3696 0.7
rules_metadata 0 0.0
events 124 0.0
quality_gates 1 0.0
quality_gate_conditions 4 0.0
properties 13 0.0
project_links 0 0.0
duplications_index 0 0.0
project_measures 18658015 2938.3
internal_properties 3 24.9
projects 407563 210.2
manual_measures 0 10.3
active_rules 2985 0.4
notifications 0 0.0
user_roles 0 0.0
active_rule_parameters 176 0.0
users 25 0.0
metrics 174 0.0
loaded_templates 2 0.0
issues 893849 274.3
issue_changes 803010 137.3
permission_templates 2 6.0
perm_tpl_characteristics 5 0.2
perm_templates_users 0 0.0
perm_templates_groups 4 0.0
qprofile_changes 3016 0.2
file_sources 283694 444.1
ce_queue 0 181.3
ce_activity 281 0.2
ce_task_characteristics 0 0.2
ce_task_input 0 0.0
ce_scanner_context 298 0.1
user_tokens 1 0.0
webhook_deliveries 0 0.0
es_queue 0 0.0
plugins 20 0.0
project_branches 57 0.0
analysis_properties 0 0.0

Migration successful in 4235.5 seconds

I changed terminal timout config and do migration again . Now it go well . Thanks very much !

Hello Alex,

I am facing issue below error when trying for migration.
FATAL: password authentication failed for user “sonar”
Command use by me is below
./mysql-migrator -source /opt/sonar_backup_7.6/sonarqube-7.6/conf/sonar.properties -target /opt/sonar/sonarqube-7.8/conf/sonar.properties
Can you please help me with my error message.

Greetings Prashant,

This thread ended quite some time ago. Please start a new one.