Sonarqube is not starting in Linux server

  • Sonarqube Developer Edition
  • I tried Zip and Docker Version
  • Just trying to get it started.

First i tried to start Sonarqube using zip version. I have unzipped it and then installed postgressql. Created sonarqube user following this doc

the sonarqube get starts and then quickly stopped. Following below is the log for es.log

2023.09.05 10:50:43 INFO  es[][o.e.x.p.ProfilingPlugin] Profiling is enabled
2023.09.05 10:50:43 INFO  es[][o.e.x.s.Security] Security is disabled
2023.09.05 10:50:44 INFO  es[][o.e.t.n.NettyAllocator] creating NettyAllocator with the following configs: [name=unpooled, suggested_max_allocation_size=1mb, factors={es.unsafe.use_unpooled_allocator=null, g1gc_enabled=true, g1gc_region_size=4mb, heap_size=512mb}]
2023.09.05 10:50:44 INFO  es[][o.e.i.r.RecoverySettings] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
2023.09.05 10:50:44 INFO  es[][o.e.d.DiscoveryModule] using discovery type [single-node] and seed hosts providers [settings]
2023.09.05 10:50:44 INFO  es[][o.e.n.Node] initialized
2023.09.05 10:50:44 INFO  es[][o.e.n.Node] starting ...
2023.09.05 10:50:44 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:33221}, bound_addresses {127.0.0.1:33221}
2023.09.05 10:50:44 INFO  es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2023.09.05 10:50:44 WARN  es[][o.e.c.c.ClusterBootstrapService] this node is locked into cluster UUID [UROEbKp1RtG9d2S4Cbv1Ug] but [cluster.initial_master_nodes] is set to [sonarqube]; remove this setting to avoid possible data loss caused by subsequent cluster bootstrap attempts; for further information see https://www.elastic.co/guide/en/elasticsearch/reference/8.7/important-settings.html#initial_master_nodes
2023.09.05 10:50:44 INFO  es[][o.e.c.s.MasterService] elected-as-master ([1] nodes joined)[_FINISH_ELECTION_, {sonarqube}{tG3-w4HUTXSVHlfLtrVRoA}{-r0Frv84TliLdXu19tWnRQ}{sonarqube}{127.0.0.1}{127.0.0.1:33221}{cdfhilmrstw}{8.7.0} completing election], term: 3, version: 10, delta: master node changed {previous [],current [{sonarqube}{tG3-w4HUTXSVHlfLtrVRoA}{-r0Frv84TliLdXu19tWnRQ}{sonarqube}{127.0.0.1}{127.0.0.1:33221}{cdfhilmrstw}{8.7.0}]}
2023.09.05 10:50:44 INFO  es[][o.e.c.s.ClusterApplierService] master node changed {previous [], current [{sonarqube}{tG3-w4HUTXSVHlfLtrVRoA}{-r0Frv84TliLdXu19tWnRQ}{sonarqube}{127.0.0.1}{127.0.0.1:33221}{cdfhilmrstw}{8.7.0}]}, term: 3, version: 10, reason: Publication{term=3, version=10}
2023.09.05 10:50:45 INFO  es[][o.e.r.s.FileSettingsService] starting file settings watcher ...
2023.09.05 10:50:45 INFO  es[][o.e.r.s.FileSettingsService] file settings service up and running [tid=31]
2023.09.05 10:50:45 INFO  es[][o.e.h.AbstractHttpServerTransport] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2023.09.05 10:50:45 INFO  es[][o.e.n.Node] started {sonarqube}{tG3-w4HUTXSVHlfLtrVRoA}{-r0Frv84TliLdXu19tWnRQ}{sonarqube}{127.0.0.1}{127.0.0.1:33221}{cdfhilmrstw}{8.7.0}{rack_id=sonarqube, xpack.installed=true}
2023.09.05 10:50:45 INFO  es[][o.e.c.c.NodeJoinExecutor] node-join: [{sonarqube}{tG3-w4HUTXSVHlfLtrVRoA}{-r0Frv84TliLdXu19tWnRQ}{sonarqube}{127.0.0.1}{127.0.0.1:33221}{cdfhilmrstw}{8.7.0}] with reason [completing election]
2023.09.05 10:50:45 INFO  es[][o.e.l.LicenseService] license [b0e830f5-02c4-447d-9a1d-853fcda93654] mode [basic] - valid
2023.09.05 10:50:45 INFO  es[][o.e.g.GatewayService] recovered [0] indices into cluster_state
2023.09.05 10:50:45 INFO  es[][o.e.h.n.s.HealthNodeTaskExecutor] Node [{sonarqube}{tG3-w4HUTXSVHlfLtrVRoA}] is selected as the current health node.
2023.09.05 10:50:45 INFO  es[][o.e.n.Node] stopping ...
2023.09.05 10:50:45 INFO  es[][o.e.r.s.FileSettingsService] shutting down watcher thread
2023.09.05 10:50:45 INFO  es[][o.e.r.s.FileSettingsService] watcher service stopped
2023.09.05 10:50:45 INFO  es[][o.e.n.Node] stopped
2023.09.05 10:50:45 INFO  es[][o.e.n.Node] closing ...
2023.09.05 10:50:45 INFO  es[][o.e.n.Node] closed

Seems like Elasticcache is getting stopped.

Then I tried to get started with Docker version. But then Even after passing Postgresql Database Connection and credentials, it’s still failing and the containers are getting crashed.

Docker Logs

"log":"\u0009at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)\n","stream":"stdout","time":"2023-09-05T10:59:38.384614199Z"}
{"log":"\u0009at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)\n","stream":"stdout","time":"2023-09-05T10:59:38.384668528Z"}
{"log":"\u0009... 44 common frames omitted\n","stream":"stdout","time":"2023-09-05T10:59:38.384686814Z"}
{"log":"Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.\n","stream":"stdout","time":"2023-09-05T10:59:38.384720681Z"}
{"log":"\u0009at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)\n","stream":"stdout","time":"2023-09-05T10:59:38.384759931Z"}
{"log":"\u0009at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)\n","stream":"stdout","time":"2023-09-05T10:59:38.384791312Z"}
{"log":"\u0009at com.zaxxer.hikari.pool.HikariPool.\u003cinit\u003e(HikariPool.java:100)\n","stream":"stdout","time":"2023-09-05T10:59:38.384828566Z"}
{"log":"\u0009at com.zaxxer.hikari.HikariDataSource.\u003cinit\u003e(HikariDataSource.java:81)\n","stream":"stdout","time":"2023-09-05T10:59:38.384853003Z"}
{"log":"\u0009at org.sonar.db.DefaultDatabase.createHikariDataSource(DefaultDatabase.java:159)\n","stream":"stdout","time":"2023-09-05T10:59:38.384892077Z"}
{"log":"\u0009at org.sonar.db.DefaultDatabase.initDataSource(DefaultDatabase.java:148)\n","stream":"stdout","time":"2023-09-05T10:59:38.384919035Z"}
{"log":"\u0009at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:126)\n","stream":"stdout","time":"2023-09-05T10:59:38.384939117Z"}
{"log":"\u0009... 48 common frames omitted\n","stream":"stdout","time":"2023-09-05T10:59:38.384957317Z"}
{"log":"Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.\n","stream":"stdout","time":"2023-09-05T10:59:38.385025032Z"}
{"log":"\u0009at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:342)\n","stream":"stdout","time":"2023-09-05T10:59:38.385030981Z"}
{"log":"\u0009at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54)\n","stream":"stdout","time":"2023-09-05T10:59:38.38506205Z"}
{"log":"\u0009at org.postgresql.jdbc.PgConnection.\u003cinit\u003e(PgConnection.java:263)\n","stream":"stdout","time":"2023-09-05T10:59:38.385102095Z"}
{"log":"\u0009at org.postgresql.Driver.makeConnection(Driver.java:443)\n","stream":"stdout","time":"2023-09-05T10:59:38.38510889Z"}
{"log":"\u0009at org.postgresql.Driver.connect(Driver.java:297)\n","stream":"stdout","time":"2023-09-05T10:59:38.385134857Z"}
{"log":"\u0009at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121)\n","stream":"stdout","time":"2023-09-05T10:59:38.385161339Z"}
{"log":"\u0009at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)\n","stream":"stdout","time":"2023-09-05T10:59:38.385182713Z"}
{"log":"\u0009at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)\n","stream":"stdout","time":"2023-09-05T10:59:38.385217499Z"}
{"log":"\u0009at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)\n","stream":"stdout","time":"2023-09-05T10:59:38.385255094Z"}
{"log":"\u0009at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)\n","stream":"stdout","time":"2023-09-05T10:59:38.385287509Z"}
{"log":"\u0009... 53 common frames omitted\n","stream":"stdout","time":"2023-09-05T10:59:38.38530301Z"}
{"log":"Caused by: java.net.ConnectException: Connection refused\n","stream":"stdout","time":"2023-09-05T10:59:38.385329878Z"}
{"log":"\u0009at java.base/sun.nio.ch.Net.pollConnect(Native Method)\n","stream":"stdout","time":"2023-09-05T10:59:38.385359775Z"}
{"log":"\u0009at java.base/sun.nio.ch.Net.pollConnectNow(Unknown Source)\n","stream":"stdout","time":"2023-09-05T10:59:38.385384363Z"}
{"log":"\u0009at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)\n","stream":"stdout","time":"2023-09-05T10:59:38.385404976Z"}
{"log":"\u0009at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)\n","stream":"stdout","time":"2023-09-05T10:59:38.385427056Z"}
{"log":"\u0009at java.base/java.net.SocksSocketImpl.connect(Unknown Source)\n","stream":"stdout","time":"2023-09-05T10:59:38.385454357Z"}
{"log":"\u0009at java.base/java.net.Socket.connect(Unknown Source)\n","stream":"stdout","time":"2023-09-05T10:59:38.385488716Z"}
{"log":"\u0009at org.postgresql.core.PGStream.createSocket(PGStream.java:243)\n","stream":"stdout","time":"2023-09-05T10:59:38.385497955Z"}
{"log":"\u0009at org.postgresql.core.PGStream.\u003cinit\u003e(PGStream.java:98)\n","stream":"stdout","time":"2023-09-05T10:59:38.385527357Z"}
{"log":"\u0009at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:132)\n","stream":"stdout","time":"2023-09-05T10:59:38.385571263Z"}
{"log":"\u0009at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:258)\n","stream":"stdout","time":"2023-09-05T10:59:38.385625995Z"}
{"log":"\u0009... 62 common frames omitted\n","stream":"stdout","time":"2023-09-05T10:59:38.385667332Z"}

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Buried in the logs…

This is going to be the root issue. Are you sure localhost:5432 is accessible to the SonarQube image? Is starting up SonarQube successful when you use the embedded database (removing any and all sonar.jdbc.* configuration)?