SonarQube已停止且未运行

时间:2019-10-15 18:16:53

标签: java linux elasticsearch sonarqube

我正在尝试设置SonarQube 7.8版本。一旦我启动了sonar.sh文件,它就开始运行,但是在那之后声纳停止了。

root@automation:/opt/sonarqube-7.8/bin/linux-x86-64# ./sonar.sh start
Starting SonarQube...
Started SonarQube.
root@automation:/opt/sonarqube-7.8/bin/linux-x86-64# ./sonar.sh status
SonarQube is not running.

我检查了日志,这就是我得到的:

--> 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.10.15 21:01:37 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube-7.8/temp
2019.10.15 21:01:37 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.10.15 21:01:37 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube-7.8/elasticsearch]: /opt/sonarqube-7.8/elasticsearch/bin/elasticsearch
2019.10.15 21:01:37 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.10.15 21:01:38 INFO  app[][o.e.p.PluginsService] no modules loaded
2019.10.15 21:01:38 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.10.15 21:01:41 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2019.10.15 21:01:41 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.10.15 21:01:41 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped

es.log文件在这里:

2019.10.15 21:01:41 ERROR es[][o.e.b.Bootstrap] Exception
java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) [elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) [elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) [elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.8.0.jar:6.8.0]
        at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) [elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.8.0.jar:6.8.0]

我不确定SonarQube为什么停止。你能帮我吗?

3 个答案:

答案 0 :(得分:1)

已解决:

首先,不要以root用户身份运行sonarqube

  1. 创建用户

    命令: useradd用户名(将用户名设置为sonaradmin(如果您不想更改任何命令)

  2. 创建密码命令:passwd username

  3. 转到/ opt /目录

3.1)将sonarqube.x.x.x重命名为sonarqube命令:sudo mv sonarqube.x.x.x sonarqube(X.X.X您应该更改目录名称)

  1. 更改权限命令:chmod 775 -R sonarqube(文件夹名称可能会更改Sonarqube)

  2. 将创建的用户添加到sonaradmin组命令:chown -R sonaradmin:sonaradmin sonarqube

  3. goto:cd / opt / sonarqube / bin / linux-x86-64 /

  4. 命令:su sonaradmin

  5. 输入密码

  6. 命令:./sonar.sh start

  7. 命令:./sonar.sh status

现在转到浏览器检查http:// localhost:9000 / sonar

希望这有帮助。...我也遇到了同样的问题,已解决

答案 1 :(得分:0)

好的,我找到了解决方案。我要做的就是更改#RUN_AS_USER= in /opt/sonarqube-7.8/bin/linux-x86-64/sonar.sh line 48 to RUN_AS_USER=sonar

答案 2 :(得分:0)

您的解决方案无效,导致控制台向我显示此消息(在编辑sonar.sh文件之后)

组:“声纳”:没有这样的用户 chown:无效的utente:“声纳:声纳” su:用户声纳不存在