https://blog.csdn.net/abcdocker/article/details/53840582
准备:centos7,jdk1.8, mysql5.6/5.7
创建数据库,参考部署链接
sonar官方下载地址:
https://binaries.sonarsource.com/Distribution/sonarqube/
下载解压mv到 /usr/local/sonar
修改为非root权限并启动,此处为worker用户:(因其中包含elasticsearch,不能以root启,并调优基本的参数)
# vim /etc/sysctl.conf
vm.max_map_count = 655360 #定义了一个进程能拥有的最多的内存区域
# sysctl -p
# vim /etc/security/limits.conf #文件描述符
* soft nofile 65535
* hard nofile 65535
# vim /etc/security/limits.d/20-nproc.conf
* soft nproc 4096
root soft nproc unlimited
# cd /usr/local/sonar/conf/
参考部署链接,这里直接贴上项目配置文件,其他默认
sonar.jdbc.username=sonaruser
sonar.jdbc.password=sonarpwd
sonar.jdbc.url=jdbc:mysql://172.21.139.13:3312/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
sonar.security.realm=LDAP
ldap.url=ldaps://ldap.xxx.com
ldap.bindDn=CN=s-ldap,OU=Service Account,DC=xx,DC=com
ldap.bindPassword=xxxxx
ldap.user.baseDn=OU=xx,OU=生态伙伴,OU=newcompany,DC=xx,DC=com
ldap.user.request=(&(objectClass=user)(sAMAccountName={login}))
ldap.user.realNameAttribute=name
ldap.user.emailAttribute=email
sonar.log.level=INFO
sonar.log.level.es=INFO
sonar.path.data=/usr/local/sonar/data
# 先启动es,默认启动端口为9200,9300
/usr/local/sonar/elasticsearch/bin/elasticsearch -d
# 此时会默认在/usr/local/sonar/temp/conf下生成es的配置文件
# 后启动sonar,默认为9000
/usr/local/sonar/bin/linux-x86-64/sonar.sh start
# 排错:查看端口是否起来,如果没起来,也就是部署失败,通过日志排查
日志路径:/usr/local/sonar/logs/
参考部署链接,此处贴上配置
sonar.host.url=http://192.168.0.29:9000
sonar.sourceEncoding=UTF-8
sonar.jdbc.username=sonaruser
sonar.jdbc.password=sonarpwd
sonar.jdbc.url=jdbc:mysql://172.21.139.13:3312/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
参考部署链接,此处贴上配置
此链接为sonar token相关信息
https://blog.csdn.net/wuxuehong0306/article/details/54585800