SonarQube 7.1-Debian 安装-连接被拒绝

SonarQube 7.1-Debian 安装-连接被拒绝

我第一次运行 SonarQube 7.1 时遇到了问题。日志中仍然有以下错误:

./sonar.sh console

org.elasticsearch.transport.ConnectTransportException: [][127.0.0.1:9001] connect_timeout[30s]
    at org.elasticsearch.transport.netty4.Netty4Transport.connectToChannels(Netty4Transport.java:362)
    at org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:570)
    at org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:117)
    at org.elasticsearch.transport.TransportService.openConnection(TransportService.java:351)
    at org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.doSample(TransportClientNodesService.java:407)
    at org.elasticsearch.client.transport.TransportClientNodesService$NodeSampler.sample(TransportClientNodesService.java:357)
    at org.elasticsearch.client.transport.TransportClientNodesService$ScheduledNodeSampler.run(TransportClientNodesService.java:390)
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:569)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:9001
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:352)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:632)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458)
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
    ... 1 common frames omitted
Caused by: java.net.ConnectException: Connection refused
    ... 10 common frames omitted

我正在尝试在 Ubuntu 19.10 和 Debian 10 上运行它。为什么版本这么老?因为我必须弄清楚如何将其升级到最新版本,所以我正在创建测试环境来执行此操作。很久以前有人确实创建了当前的生产版本,从那时起就没人碰过它 :)

到目前为止已经做了什么: - 我已经停止并禁用了 ufw 和 iptables - Java 版本几乎与生产版本相同。

sonarqube@sonarqube-srv:/$ java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
sonar configuration looks like this:
sonarqube@sonarqube-srv:/$ grep "^[^#;]" /opt/sonarqube-7.1/conf/sonar.properties 
sonar.web.javaOpts=-Xmx2048m -Xms128m -XX:+HeapDumpOnOutOfMemoryError
sonar.web.host=127.0.0.1
sonar.web.context=/sonarqube
sonar.web.port=9000
sonar.ce.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError
sonar.search.javaOpts=-Xms512m -Xmx2048m -XX:+HeapDumpOnOutOfMemoryError
sonar.search.port=9001
sonar.search.host=127.0.0.1
sonar.log.level=DEBUG
sonar.log.level.app=DEBUG
sonar.log.level.web=DEBUG
sonar.log.level.ce=DEBUG
sonar.log.level.es=DEBUG
sonar.log.rollingPolicy=time:yyyy-MM-dd
sonar.log.maxFiles=7
sonar.web.accessLogs.enable=true
sonar.telemetry.enable=false

当我运行 ./sonar.sh start 而不是 ./sonar.sh console 时,我收到如下错误:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fe83110eb21, pid=5723, tid=0x00007fe848814700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_231-b11) (build 1.8.0_231-b11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.231-b11 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# J 21 C1 java.lang.String.getChars(II[CI)V (62 bytes) @ 0x00007fe83110eb21 [0x00007fe83110eb00+0x21]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /opt/sonarqube-7.1/elasticsearch/hs_err_pid5723.log

答案1

我之前遇到过这个错误,我的解决方法是:

  1. 确保运行 sonar 的用户有权访问 Sonar 的根文件夹。您可以通过运行sudo chown -R <sonar-user>:<sonar-user-group> <sonar installation dir>
  2. 如果不需要,请删除(或重命名)Sonar 安装目录内的临时和日志文件夹。

相关内容