After database move, projects not showing up

I’m performing some first steps in upgrading to latest version… we are starting with SQ 6.7.6 running on PostgreSQL. End state is to use SQ 9.x on SQL Server. App and database are running on Windows Server 2012.

Steps to migrate databases work fine:

  • Install second instance SQ 6.7.6 and connect to SQL Server
  • Stop both copies
  • Run sonar-db-copy to copy PostgreSQL data over to SQL Server
  • Start SQ 6.7.6 (SQL Server)

My problem is now the analyzed Projects don’t show up and I’ve read in various posts to delete the Elasticsearch data directory and let it rebuild… but when I restart the Elasticsearch Service, it recreates the data directory in the SQ 6.7.6 PostgreSQL home…

How do I “install” Elasticsearch from my new SonarQube Home and pull in the analyzed projects from before? Seems this is my missing piece…

Thanks!

Hi,

There’s nothing to install with regard to Elasticsearch. That process is started and managed by SonarQube itself. Simply start the instance and it will rebuild its own ES indices.

 
Ann

Thank you Ann… however, after starting up Elasticsearch in my new SQ installation, I don’t see any of the previously analyzed projects, nor any newly analyzed ones either.

From log files, it doesn’t seem that there are any errors and I see that Elasticsearch is “starting” fine, but never does any indexing…

I don’t see any any of the batch or conf files where Elasticsearch is launched by SQ. If I just start the SQ service, Elasticsearch never starts…

I did end up running the elasticsearch.bat file to create a service… but that doesn’t seem to work either. :woozy_face:

Any thoughts?

Hi,

You shouldn’t be starting ES independently of SonarQube.

What do you see in your server logs?

 
Ann

Hello Ann,

Found out the problem… as you said Elasticsearch didn’t need to be “started” but the data being used was old. Some documents talk about removing the cache directory for Elasticsearch, so naturally, I assumed that meant %SONARQUBE_HOME%/elasticsearch/cache/* but that was not correct.

The solution is to remove the cache directory that is under %SONARQUBE_HOME%. I stopped the service, removed the subdirectories under %SONARQUBE_HOME%/cache, then restarted the service… and I’m now able to see all my projects and portfolios!

Thanks for your assistance!

Joe