Issues in integrating ElasticSearch with SonarQube

elasticsearch

(Ketan Sahasrabudhe) #1

SonarQube version used: 7.3
What am I trying to do: Integrate elasticsearch with SonarQube. Not being able to start SonarQube
What have I done so far?-- Details provided below:
Triggering event:
Running StartSonar.bat file.
Error message in sonarqube console and sonar.log file:
“Waiting for Elasticsearch to be up and running”
Actions performed:

  1. Started elastic search by running “elasticsearch.bat” in the “elasticsearch-6.4.0\bin” folder.
  2. Confirmed that elastic search is up at the URL: http://localhost:9200/
    JSON displayed at the above URL:
{
"name" : "jcj1BDh",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "T1ke4ACrTMWU0zXalrh43w",
"version" : {
"number" : "6.4.0",
"build_flavor" : "default",
"build_type" : "zip",
"build_hash" : "595516e",
"build_date" : "2018-08-17T23:18:47.308994Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
  1. Started SonarQube by running the file “StartSonar.bat” in the folder “sonarqube-7.3\bin\windows-x86-64”
  2. Relevant snippet from sonar.log provided below:
========================================================
--> Wrapper Started as Console
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

2018.09.18 17:11:29 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory D:\CoreJava\SonarQube\sonarqube-7.3\temp
2018.09.18 17:11:29 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9200
2018.09.18 17:11:29 WARN app[][o.s.a.es.EsSettings] Elasticsearch HTTP connector is enabled on port 9200. MUST NOT BE USED FOR PRODUCTION
2018.09.18 17:11:29 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [D:\CoreJava\SonarQube\sonarqube-7.3\elasticsearch]: C:\Program Files\Java\jre1.8.0_131\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=D:\CoreJava\SonarQube\sonarqube-7.3\elasticsearch -cp lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.conf=D:\CoreJava\SonarQube\sonarqube-7.3\temp\conf\es
2018.09.18 17:11:29 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2018.09.18 17:11:29 INFO app[][o.e.p.PluginsService] no modules loaded
2018.09.18 17:11:29 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2018.09.18 17:11:34 WARN app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 1
2018.09.18 17:11:34 INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped
2018.09.18 17:11:34 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
========================================================
5. Relevant entries in the sonar.properties file provided below:
========================================================
sonar.search.port=9200
sonar.search.host=127.0.0.1
sonar.search.httpPort=9200
Entries below might not be relevant, but provided for reference
sonar.web.host=127.0.0.1
sonar.web.context=/sonar
sonar.path.data=data
sonar.path.temp=temp
========================================================

postgre DB and elastic search are running when I try to start sonarqube.
Have I done any mistake in the configuration or missed something?
-Thanks.


(G Ann Campbell) #2

Hi,

There’s no need to “integrate” Elasticsearch. SonarQube completely handles Elasticsearch on its own. The fact that you have a separate instance running is most likely the problem. You should shut it down and simply spin up SonarQube. If you’re still having problems after that, take a look at the Troubleshooting guide, and come back to us with your log errors.

 
Ann


(Ketan Sahasrabudhe) #3

Thanks Ann for the quick reply.

I will take a look at the guide you have suggested below.

Thanks & Regards,

Ketan Sahasrabudhe.


(Ketan Sahasrabudhe) #4

Hi Ann,

Post your reply, following are the activities I performed:

  1. Stopped using (starting) elasticsearch before running sonar (StartSonar.bat file)

  2. I realized that port 9000 was being used within our organization, so changed the entry “sonar.web.port” in sonar.properties file to have value “9002” rather than “9000”. I have confirmed that the port “9002” is available. Running “netstat –a | find “9002” produces no result.

  3. Created an environment variable “SONARQUBE_HOME” pointing to the base directory of SonarQube installation.

  4. Created a user and a database in Postgre SQL with the username “sonarqube” and password (specified in the sonar.properties file). I guess this was the stumbling block.

Finally got the sonar qube running J! Thank you for your help.

You must already be knowing a hell lot about Sonarqube, but listed the action items mentioned above just in case.

Thanks & Regards,

Ketan Sahasrabudhe.


(G Ann Campbell) #5

Hi Ketan,

I’m glad you got it working. Thanks for following up with your steps to success!

 
:slight_smile:
Ann