sonar启动报错Process exited with exit value [es]: 143

1,787 阅读2分钟

这是我参与8月更文挑战的第5天,活动详情查看:8月更文挑战

记录一下排错过程,希望能帮助到需要的人,也给新人带来一些排错经验

我是用非root用户启动的sonar,但是依旧无法访问web页面

image-20210809163339761

image-20210809163354640

查看一下soanr状态,发现已经停止运行

image-20210809163511583

查看端口占用情况,并没有占用

image-20210809163644655

查看日志,发现es有报错

Process exited with exit value [es]: 143

image-20210809163804970

查看es的日志,发现三条警告信息

image-20210809164028898

image-20210809164151732

  •  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

image-20210809165428726

使用ulimit -Hn指令查看配置是否生效:

image-20210809172249801

  •  max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
    

/etc/sysctl.conf配置文件中添加vm.max_map_count的值

image-20210809164912411

然后执行sysctl -p使配置生效

image-20210809165244967

然后发现还是启动不了。

我们再看一下错误报告,会发现先是web程序停止,后是es程序停止

image-20210810095817183

那么我们有必要去看一下web的日志

image-20210810101316911

然后发现,它经历了【启动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端口被占用,需要更改。

image-20210810103336494

再次启动sonar,su 用户名 ./bin/linux-x86-64/sonar.sh start

image-20210810103508444

成功!