Sonarqube 重新启动后无法启动

Sonarqube fails to start after reboot

提问人:N. J 提问时间:11/2/2023 更新时间:11/2/2023 访问量:28

问:

我没有得到太多信息systemctl status:

sonar.local.lab sonar.sh[4471]: Gracefully stopping SonarQube...
sonar.local.lab sonar.sh[4471]: Removed stale pid file: ./SonarQube.pid
sonar.local.lab sonar.sh[4471]: SonarQube was not running.

从 /var/log/sonarqube/es.log

java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:107) ~[elasticsearch-7.17.4.jar:7.17.4]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183) ~[elasticsearch-7.17.4.jar:7.17.4]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) [elasticsearch-7.17.4.jar:7.17.4]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) [elasticsearch-7.17.4.jar:7.17.4]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) [elasticsearch-7.17.4.jar:7.17.4]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) [elasticsearch-7.17.4.jar:7.17.4]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) [elasticsearch-cli-7.17.4.jar:7.17.4]
        at org.elasticsearch.cli.Command.main(Command.java:77) [elasticsearch-cli-7.17.4.jar:7.17.4]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122) [elasticsearch-7.17.4.jar:7.17.4]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) [elasticsearch-7.17.4.jar:7.17.4]
2023.11.01 16:26:49 ERROR es[][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]

/etc/systemd/system/sonar.service

[Unit]
Description=SonarQube 9.6.1.59531 service
Requires=network.target
After=network.target network-online.target
Wants=network-online.target

[Service]
Type=forking
User=sonar
Group=sonar
ExecStart=/my/custom/path/sonarqube-9.6.1.59531/bin/linux-x86-64/sonar.sh start
ExecStop=/my/custom/path/sonarqube-9.6.1.59531/bin/linux-x86-64/sonar.sh stop
ExecReload=/my/custom/path/sonarqube-9.6.1.59531/bin/linux-x86-64/sonar.sh restart
Restart=on-failure
RestartSec=10
PIDFile=/my/custom/path/sonarqube-9.6.1.59531/bin/linux-x86-64/SonarQube.pid
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

我已经验证了用户和组是每个文件的所有者sonar/my/custom/path/...

我不知道为什么elasticsearch抱怨以root身份运行。是的,我尝试重新启动正在运行的服务:但是,从文件中,这不会运行声纳用户和组吗?systemctl restart sonarsonar.service

Java Linux sonarqube Ubuntu-18.04

评论

0赞 M. Rizzo 11/2/2023
sonar.sh 脚本中将 RUN_AS_USER 属性设置为什么?
0赞 N. J 11/2/2023
这种属性并不存在。grep RUN_AS_USER /my/custom/path/sonarqube-9.6.1.59531/bin/linux-x86-64/sonar.sh
0赞 M. Rizzo 11/2/2023
对不起,他们在 v9.6.1 中删除了该属性。
0赞 N. J 11/2/2023
community.sonarsource.com/t/....原来 temp/conf 文件归 root 所有。我只是。可能不是解决这个问题的正确方法(长期),但它有效。chown -R sonar:sonar

答: 暂无答案