Issues in integrating ElasticSearch with SonarQube

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.

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

Thanks Ann for the quick reply.

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

Thanks & Regards,

Ketan Sahasrabudhe.

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.

3 Likes

Hi Ketan,

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

 
:slight_smile:
Ann

Hi Ann,

I have installed Sonarqube 7.7 on AWS server with CentOS 7, MYSQL version 5.6.43

When i start sonarqube with non-root user i get the message as

Started Sonarqube

After checking the status it says: SonarQube is not running… Checked everything but nothing seems to be working…

es.log shows cannot run elasticsearch as root but I am starting sonarqube and elasticsearch as non-root user… Getting error code 143 in sonar.sh console… Dunno what to do… Please help

Regards,

Karishma

Hi Karishma,

How are you starting SonarQube? Is it perhaps by triggering a script that uses root under the covers?

 
Ann

/opt/sonarqube/bin/linux-x86-64/sonar.sh start
It says: Starting SonarQube and started SonarQube
But in few secinds after i run ./sonar.sh status: SonarQube is not running

Hi,

SonarQube doesn’t escalate its own privileges. You’re triggering this script as root or I guess a user with root-like permissions.

 
Ann

Hi Ann,

Thanks for the reply but I am running the start script as a non root user… Elasticsearch is active and running… But SonarQube starts and immediately stops… Please help…

Hi Ann,

I uninstalled n installed sonarqube and its working fine now… Thanks a lot for your help!!!

Hi Ann,
I am getting an error related to elasticsearch while starting sorarqube “exception caught on transport layer [Netty4TcpChannel{localAddress=/127.0.0.1:46716, remoteAddress=/127.0.0.1:9001}], closing connection
jvm 1 | io.netty.handler.codec.DecoderException: java.io.StreamCorruptedException: invalid internal transport message format, got (48,54,54,50)”
command “sonar.sh console”
Do you have any idea?

Hi Ann,

Sorry to write you for just a simple thing, i got the solution, i just have to update
file: “sonar.properties”, variable: “sonar.search.port=9002”.

Thanks

1 Like