Ubuntu重启后SonarQube无法启动问题求助
SonarQube重启后无法访问localhost:9000的解决办法
问题核心
系统重启后SonarQube无法通过localhost:9000访问,错误日志显示Elasticsearch进程以退出码78终止,直接导致SonarQube启动失败。
错误日志详情:
2023.08.30 04:57:23 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 78 2023.08.30 04:57:23 INFO app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped 2023.08.30 04:57:23 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped 2023.08.30 05:01:05 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp 2023.08.30 05:01:05 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:35339] 2023.08.30 05:01:05 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch 2023.08.30 05:01:06 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running 2023.08.30 05:01:28 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 78 2023.08.30 05:01:28 INFO app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped 2023.08.30 05:01:28 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped sonar@ubuntu-virtual-machine:~/bin/linux-x86-64$
解决方案
修复目录权限:确保SonarQube安装目录及子目录归sonar用户所有,执行命令:
sudo chown -R sonar:sonar /opt/sonarqube调整系统虚拟内存参数:Elasticsearch要求
vm.max_map_count至少为262144,系统重启后该参数可能被重置:- 临时生效:
sudo sysctl -w vm.max_map_count=262144 - 永久生效:编辑
/etc/sysctl.conf文件,添加一行vm.max_map_count=262144,然后执行:sudo sysctl -p
- 临时生效:
查看详细错误日志:检查Elasticsearch专属日志获取更精准的故障原因,执行命令:
cat /opt/sonarqube/logs/elasticsearch.log | tail -20
内容的提问来源于stack exchange,提问作者Olumide Akinyemi
相关产品推荐
相关产品推荐

