我按照本教程在 CentOS 7 中设置 SonarQube:https://thegeeksalive.com/how-to-install-sonarqube-on-centos/
最后我启动了我的声纳,但由于内存问题而无法启动。
--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
2019.07.24 10:58:55 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.07.24 10:58:55 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.07.24 10:58:55 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.07.24 10:58:55 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.07.24 10:58:55 INFO app[][o.e.p.PluginsService] no modules loaded
2019.07.24 10:58:55 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2019.07.24 10:59:08 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2019.07.24 10:59:08 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/java/jdk-11.0.4/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/mysql/mysql-connector-java-5.1.46.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process16556217505100103896properties
2019.07.24 10:59:12 INFO app[][o.s.a.SchedulerImpl] Process[web] is stopped
2019.07.24 10:59:12 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2019.07.24 10:59:12 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.07.24 10:59:12 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
希望大家帮我找到解决办法。谢谢!
检查您的 SonarQube 主目录中的
logs/es.log
中有什么内容。在 Linux 上启动 SonarQube 的许多问题都会显示诸如 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
之类的消息
如果您看到此内容,那么您应该在启动 SonarQube 之前运行以下命令
sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65535
我猜你正在尝试使用 docker compose 来启动 sonarqube 服务。 你可以尝试用这个。
就我而言,在 docker compose 中设置
security_opt
有帮助:
services:
sonarqube:
image: sonarqube:10.2.1-community
security_opt:
- seccomp:unconfined
(...)
此错误很可能是由于项目太大而导致 SonarQube 无法使用默认内存设置进行扫描。
尝试以下解决方法:
export _JAVA_OPTIONS="-Xmx1g"