SonarQube系列(一)安装

Time: 202010月
Operation System: CentOS7
RAM: 4G
Java Version: 11.0.8
SonarQube Version: 8.0

之前在公众号也写过一篇关于SonarQube的文章,本文将针对这篇文章进行一个完善,包括SonarQube安装、使用、集成三个部分,后期有时间会写一篇关于规则优化的文章。原微信公众号文章地址:SonarQube实现自动化代码扫描 https://mp.weixin.qq.com/s/L5WeEFvu6etVTAigx6jjcQ

官网也有安装文档:https://docs.sonarqube.org/latest/setup/install-server/ 这里安装就贴原文就好了

SonarQube的依赖

运行内存依赖

A small-scale (individual or small team) instance of the SonarQube server requires at least 2GB of RAM to run efficiently and 1GB of free RAM for the OS.

If you’re running on Linux, you must ensure that:

  • vm.max_map_count is greater than or equal to 524288
  • fs.file-max is greater than or equal to 131072
  • the user running SonarQube can open at least 131072 file descriptors
  • the user running SonarQube can open at least 8192 threads

You can see the values with the following commands:

sysctl vm.max_map_count
sysctl fs.file-max
ulimit -n
ulimit -u

You can set them dynamically for the current session by running the following commands as root:

sysctl -w vm.max_map_count=524288
sysctl -w fs.file-max=131072
ulimit -n 131072
ulimit -u 8192

以上是临时解决方案,但是如果需要永久生效需要进行如下配置:

# 在sysctl配置文件中添加 vm.max_map_count=655360
vim /etc/sysctl.conf

vm.max_map_count=655360

# 使sysctl配置立即生效
sysctl -p

# 在limits配置文件中添加
vim /etc/security/limits.conf

*       soft    nofile  65536
*       hard    nofile  65536

# 要使limits配置生效不需要重启系统,但是需要重新登录用户

如果按照官方文档的提示进行配置,那么在虚拟机中就可能出现SonarQube服务无法启动,日志记录如下:

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max virtual memory areas vm.max_map_count [65530] is too low,
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值