这是我参与8月更文挑战的第5天,活动详情查看:8月更文挑战
记录一下排错过程,希望能帮助到需要的人,也给新人带来一些排错经验
我是用非root用户启动的sonar,但是依旧无法访问web页面
查看一下soanr状态,发现已经停止运行
查看端口占用情况,并没有占用
查看日志,发现es有报错
Process exited with exit value [es]: 143
查看es的日志,发现三条警告信息
-
setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.
未解决
-
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
在/etc/security/limits.conf
配置文件中添加
用户名 hard nofile 65536
用户名 soft nofile 65536
使用ulimit -Hn
指令查看配置是否生效:
-
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
在/etc/sysctl.conf
配置文件中添加vm.max_map_count
的值
然后执行sysctl -p
使配置生效
然后发现还是启动不了。
我们再看一下错误报告,会发现先是web程序停止,后是es程序停止
那么我们有必要去看一下web的日志
然后发现,它经历了【启动web】->【连接es】->【创建数据库连接】->【web启动失败】->【java异常报错】
Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
无法连接到数据库。 请检查连接和设置(请参阅以“sonar.jdbc.”为前缀的属性)。
原来是连接数据库失败
-
修改sonar配置文件
opt/sonarqube-6.7.4/conf/sonar.properties
修改数据库连接用户名和密码,以及取消注释图中底行的连接地址
Ps:sonar默认监听9000端口,如果9000端口被占用,需要更改。
再次启动sonar,su 用户名 ./bin/linux-x86-64/sonar.sh start
成功!