声纳与MySql的设置

7

我正在尝试将Sonar Qube 5.5的默认数据库更改为Mysql。但它仍然连接到默认的H2数据库。

以下是配置信息。

我已在Mysql数据库中运行了以下脚本。

# Create SonarQube database and user.
#
# Command: mysql -u root -p < create_database.sql
#

    CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;

    CREATE USER 'sonar' IDENTIFIED BY 'sonar';
    GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
    GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
    FLUSH PRIVILEGES;

取消注释Mysql的sonar.jdbc.url后,我无法看到H2数据库的配置以注释它。

  # Property values can:                                                                                                                               
    # - reference an environment variable, for example sonar.jdbc.url= ${env:SONAR_JDBC_URL}                                                             
    # - be encrypted. See http://redirect.sonarsource.com/doc/settings-encryption.html                                                                   



#--------------------------------------------------------------------------------------------------                                                  
# DATABASE                                                                                                                                           
#                                                                                                                                                    
# IMPORTANT: the embedded H2 database is used by default. It is recommended for tests but not for                                                    
# production use. Supported databases are MySQL, Oracle, PostgreSQL and Microsoft SQLServer.                                                         

# User credentials.                                                                                                                                  
# Permissions to create tables, indices and triggers must be granted to JDBC user.                                                                   
# The schema must be created first.                                                                                                                  
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.x                                                                                                                                     
# Only InnoDB storage engine is supported (not myISAM).                                                                                              
# Only the bundled driver is supported. It can not be changed.                                                                                       
sonar.jdbc.url=jdbc:mysql://10.9.153.6:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

然后我从管理 -> 系统 -> 系统信息重启了服务器。

重启后使用命令行出现以下错误:

2017.07.20 22:32:54 WARN  web[o.s.p.ProcessEntryPoint] Fail to start web                                                                             
java.lang.IllegalStateException: Webapp did not start                                                                                                
        at org.sonar.server.app.EmbeddedTomcat.isUp(EmbeddedTomcat.java:84) ~[sonar-server-5.5.jar:na]                                               
        at org.sonar.server.app.WebServer.isUp(WebServer.java:48) [sonar-server-5.5.jar:na]                                                          
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:105) ~[sonar-process-5.5.jar:na]                                        
        at org.sonar.server.app.WebServer.main(WebServer.java:69) [sonar-server-5.5.jar:na]                                                          
2017.07.20 22:32:54 INFO  web[o.a.c.h.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-0.0.0.0-9000"]                                           
2017.07.20 22:32:55 INFO  web[o.a.c.h.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-0.0.0.0-9000"]                                          
2017.07.20 22:32:55 INFO  web[o.a.c.h.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-0.0.0.0-9000"]                                        
2017.07.20 22:32:55 INFO  web[o.s.s.a.TomcatAccessLog] Web server is stopped  

你在进行这些配置更改后重启了吗? - G. Ann - SonarSource Team
嗨,是的,我从管理->系统->Systeminfo选项重新启动了服务器。默认情况下,H2数据库的配置在哪里? - Ravi
1个回答

4

您似乎已经进行了正确的配置更改,但您在 UI 中执行的重启不是“完整”的重启。请从命令行执行重启,您的实例应该能够连接到您配置的数据库。


嗨,我重新启动了服务器,但在主贴中更新时出现了错误。 - Ravi
网站日志记录了什么信息? - G. Ann - SonarSource Team
1
嗨,Ann,我发现安装的MySQL版本存在问题。Sonar 5.5仅支持MySQL版本5.6和5.7,而安装的版本为5.1。我现在能够将Sonar连接到MySQL,但现在出现了不同的问题。我将为此创建一个单独的帖子。谢谢。 - Ravi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接