sonarqube  安装配置

http:// www.sonarqube.org

MySQL

Unsupported mysql version: 5.5. Minimal supported version is 5.6.

There are two well-known engines that can be used in MySQL: MyISAM and InnoDB. MyISAM is the oldest of the two engines and is being progressively replaced by InnoDB. InnoDB is clearly faster and scales better with SonarQube as the number of projects under quality control increases. If you were an early adopter of SonarQube, you probably have a series of table that are still using MyISAM. To improve performances, you should change the engine for all tables to InnoDB.

Once all SonarQube tables are using the InnoDB engine, the first thing to do is allocate a maximum amount of RAM to your MySQL instance with the innodb_buffer_pool_size parameter and give at least 15Mb to the query_cache_size parameter. Read this article about InnoDB Performance Optimization Basics for more information.

1.数据库配置
进入数据库命令
#mysql -u root -p

mysql> CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci; 
mysql> CREATE USER 'sonar' IDENTIFIED BY 'sonar';
mysql> GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
mysql> GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
mysql> FLUSH PRIVILEGES;


mysql> show variables like '%storage_engine%';

vi /etc/my.cnf
[mysqld] # 增加
default-storage-engine=INNODB

innodb_buffer_pool_size = 256M #设大,专门的服务器为 70-80%

query_cache_type=1
query_cache_size=32M

安装

 wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-5.6.zip

解压

进入sonarqube目录

vi sonar.properties 

修改

sonar.jdbc.username=sonar
sonar.jdbc.password=sonar

#----- Embedded Database (default)
# H2 embedded database server listening port, defaults to 9092
#sonar.embeddedDatabase.port=9092
#----- MySQL 5.6 or greater
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported. It can not be changed.
sonar.jdbc.url=jdbc:mysql://172.18.22.122:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

sonar.web.context=/sonar

启动:

/home/openim/sonarqube-5.6/bin/linux-x86-64/sonar.sh start

 访问:

http://172.18.22.122:9000/sonar

使用

初始密码: admin/admin

汉化:插件中心,找到语言,下载并安装

checkstyle PMD cobertura(测量测试覆盖率)的常用插件也安装

重启生效

manen配置:

<profile>

<id>sonar</id>

<activation>

<activeByDefault>true</activeByDefault>

</activation>

<properties>

<sonar.jdbc.url>

jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8

</sonar.jdbc.url>

<sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>

<sonar.jdbc.username>sonar</sonar.jdbc.username>

<sonar.jdbc.password>sonar</sonar.jdbc.password>

<sonar.host.url>http://localhost:9000</sonar.host.url>

</properties>

</profile>

原文地址:https://www.cnblogs.com/hujihon/p/5677607.html