码迷,mamicode.com
首页 > 其他好文 > 详细

SonarQube升级

时间:2014-08-20 00:08:15      阅读:319      评论:0      收藏:0      [点我收藏+]

标签:sonar   sonarqube   升级   mysql   innodb   

1.阅读SonarQube更新日志:

http://docs.codehaus.org/display/SONAR/Upgrading#Upgrading-ReleaseUpgradeNotes


2.停止SonarQube服务:

bin/<SYSTEM>/sonar stop

3.下载新版本的SonarQube及SonarQube Runner,并解压至新的目录NEW_SONARQUBE_HOME

http://www.sonarqube.org/downloads/


4.更新NEW_SONARQUBE_HOME/conf下sonar.properties与wrapper.conf文件里的内容,文件内容参照OLD_SONARQUBE_HOME/conf下相应配置文件的内容,但切记千万不要直接将原来的配置文件拷贝覆盖,因为新的sonar.properties与wrapper.conf文件还包含新版本的一些配置项。


5.拷贝OLD_SONARQUBE_HOME/extensions/plugins中的插件至NEW_SONARQUBE_HOME/extensions/plugins


6.如果使用的是自定义的JDBC驱动,将其拷贝至NEW_SONARQUBE_HOME/extensions/jdbc-driver/<dialect>


7.备份数据库:MySQL:

/usr/local/mysql# mysqldump -u sonar -p sonar>sonar.sql
8.启动SonarQube:
bin/<SYSTEM>/sonar stop
9.用浏览器访问http://localhost:9000/setup (注意:不再是直接访问localhost:9000),根据提示升级

10.根据实际情况修改系统中或持续集成中所有涉及SONAR_HOME和SONAR_RUNNER_HOME环境变量

11.使用新版SonarQube Runner分析项目


可能遇到的问题:
一、分析项目时报插件兼容性错误
解决:登录http://localhost:9000 WEB中配置——更新中心,将plugins都更新至最新版本
注:更新Java Plugin时将会有个警告,
  • Version 2.4 moves Java from being an "ecosystem" of multiple plugins to a single, stand-along plugin that encompasses most of the functionality formerly contained in the ecosystem. Unfortunately, SonarQube‘s update center cannot handle the switch gracefully. You may use the update center to download the new version of the plugin. However,you must manually remove the Surefire, JaCoCo, and Squid for Java plugins from $SONARQUBE_HOME/extensions/plugins.
因此,在更新中心中下载新版本Java Plugin后,需要将$SONARQUBE_HOME/extensions/plugins下老的Surefire, JaCoCo, and Squid插件jar包删除,并重启服务

二、Impossible to upgrade database
Migration failed: An error has occurred, all later migrations canceled: ActiveRecord::JDBCError: Specified key was too long; max key length is 1000 bytes: CREATE UNIQUE INDEX `rules_repo_key` ON `rules` (`plugin_name`, `plugin_rule_key`) .
Please check logs.

原因:Sonar在MySQL中对表建立索引时,key的长度超过1000 bytes了,由于MySQL使用MyISAM engine时会有key长度的限制,若MySQL使用的是MyISAM engine的话将会出现这个问题

解决:将MySQL的默认engine修改为INNODB
1.检查当前的引擎 
mysql> show engines; 

2.确认确实使用的是MyISAM后,将默认engine修改为INNODB,并重启MySQL服务
修改my.cnf配置文件:
/etc/mysql/my.cnf
default-storage-engine=INNODB
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/var
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/var
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

3.查看是否支持动态加载
mysql>show variables like "have_%";
查看have_dynamic_loading这行,如果是YES,则继续 

4.安装插件
mysql>INSTALL PLUGIN INNODB SONAME 'ha_innodb_plugin.so';  
mysql>INSTALL PLUGIN INNODB_TRX SONAME 'ha_innodb_plugin.so';  
mysql>INSTALL PLUGIN INNODB_LOCKS SONAME 'ha_innodb_plugin.so';  
mysql>INSTALL PLUGIN INNODB_LOCK_WAITS SONAME 'ha_innodb_plugin.so';  
mysql>INSTALL PLUGIN INNODB_CMP SONAME 'ha_innodb_plugin.so';  
mysql>INSTALL PLUGIN INNODB_CMP_RESET SONAME 'ha_innodb_plugin.so';  
mysql>INSTALL PLUGIN INNODB_CMPMEM SONAME 'ha_innodb_plugin.so';  
mysql>INSTALL PLUGIN INNODB_CMPMEM_RESET SONAME 'ha_innodb_plugin.so' 
5.再次查看当前的引擎
mysql> show engines;

6.查看sonar库中有哪些表是使用的MyISAM engine(注:这里TABLE_SCHEMA中的‘sonar’为安装sonar建库时数据库的名称,需改成自身建库时的名称

SELECT TABLE_NAME, ENGINE   FROM information_schema.TABLES   WHERE TABLE_SCHEMA = ‘sonar‘;
+---------------------------+--------+
| TABLE_NAME                | ENGINE |
+---------------------------+--------+
| action_plans              | MyISAM |
| active_dashboards         | MyISAM |
| active_rule_changes       | MyISAM |
| active_rule_param_changes | MyISAM |
| active_rule_parameters    | MyISAM |
| active_rules              | MyISAM |
| activities                | MyISAM |
| authors                   | MyISAM |
| characteristics           | MyISAM |
| dashboards                | MyISAM |
| dependencies              | MyISAM |
| duplications_index        | MyISAM |
| events                    | MyISAM |
| graphs                    | MyISAM |
| group_roles               | MyISAM |
| groups                    | MyISAM |
| groups_users              | MyISAM |
| issue_changes             | MyISAM |
| issue_filter_favourites   | MyISAM |
| issue_filters             | MyISAM |
| issues                    | MyISAM |
| loaded_templates          | MyISAM |
| manual_measures           | MyISAM |
| measure_filter_favourites | MyISAM |
| measure_filters           | MyISAM |
| metrics                   | MyISAM |
| notifications             | MyISAM |
| perm_templates_groups     | MyISAM |
| perm_templates_users      | MyISAM |
| permission_templates      | MyISAM |
| project_links             | MyISAM |
| project_measures          | MyISAM |
| projects                  | MyISAM |
| properties                | MyISAM |
| quality_gate_conditions   | MyISAM |
| quality_gates             | MyISAM |
| resource_index            | MyISAM |
| rules                     | MyISAM |
| rules_parameters          | MyISAM |
| rules_profiles            | MyISAM |
| schema_migrations         | MyISAM |
| semaphores                | MyISAM |
| snapshot_data             | MyISAM |
| snapshot_sources          | MyISAM |
| snapshots                 | MyISAM |
| user_roles                | MyISAM |
| users                     | MyISAM |
| widget_properties         | MyISAM |
| widgets                   | MyISAM |
+---------------------------+--------+
49 rows in set (0.01 sec)
7.将相应的表更新为INNODB
ALTER TABLE sonar.widget_properties ENGINE=INNODB;        
ALTER TABLE sonar.widgets ENGINE=INNODB;                  
ALTER TABLE sonar.user_roles ENGINE=INNODB;               
ALTER TABLE sonar.users ENGINE=INNODB;                    
ALTER TABLE sonar.snapshot_sources ENGINE=INNODB;         
ALTER TABLE sonar.snapshot_data ENGINE=INNODB;            
ALTER TABLE sonar.snapshots ENGINE=INNODB;                
ALTER TABLE sonar.semaphores ENGINE=INNODB;               
ALTER TABLE sonar.schema_migrations ENGINE=INNODB;        
ALTER TABLE sonar.rules_profiles ENGINE=INNODB;           
ALTER TABLE sonar.rules_parameters ENGINE=INNODB;         
ALTER TABLE sonar.rules ENGINE=INNODB;                    
ALTER TABLE sonar.resource_index ENGINE=INNODB;           
ALTER TABLE sonar.quality_gate_conditions ENGINE=INNODB;  
ALTER TABLE sonar.quality_gates ENGINE=INNODB;            
ALTER TABLE sonar.properties ENGINE=INNODB;               
ALTER TABLE sonar.project_measures ENGINE=INNODB;         
ALTER TABLE sonar.project_links ENGINE=INNODB;            
ALTER TABLE sonar.projects ENGINE=INNODB;                 
ALTER TABLE sonar.perm_templates_users ENGINE=INNODB;     
ALTER TABLE sonar.perm_templates_groups ENGINE=INNODB;    
ALTER TABLE sonar.permission_templates ENGINE=INNODB;     
ALTER TABLE sonar.notifications ENGINE=INNODB;            
ALTER TABLE sonar.metrics ENGINE=INNODB;                  
ALTER TABLE sonar.measure_filter_favourites ENGINE=INNODB;
ALTER TABLE sonar.measure_filters ENGINE=INNODB;          
ALTER TABLE sonar.manual_measures ENGINE=INNODB;          
ALTER TABLE sonar.loaded_templates ENGINE=INNODB;         
ALTER TABLE sonar.issue_filter_favourites ENGINE=INNODB;  
ALTER TABLE sonar.issue_filters ENGINE=INNODB;            
ALTER TABLE sonar.issue_changes ENGINE=INNODB;            
ALTER TABLE sonar.issues ENGINE=INNODB;                   
ALTER TABLE sonar.group_roles ENGINE=INNODB;              
ALTER TABLE sonar.groups_users ENGINE=INNODB;             
ALTER TABLE sonar.groups ENGINE=INNODB;                   
ALTER TABLE sonar.graphs ENGINE=INNODB;                   
ALTER TABLE sonar.events ENGINE=INNODB;                   
ALTER TABLE sonar.duplications_index ENGINE=INNODB;       
ALTER TABLE sonar.dependencies ENGINE=INNODB;             
ALTER TABLE sonar.dashboards ENGINE=INNODB;               
ALTER TABLE sonar.characteristics ENGINE=INNODB;          
ALTER TABLE sonar.authors ENGINE=INNODB;                  
ALTER TABLE sonar.activities ENGINE=INNODB;               
ALTER TABLE sonar.active_rule_param_changes ENGINE=INNODB;
ALTER TABLE sonar.active_rule_parameters ENGINE=INNODB;   
ALTER TABLE sonar.active_rule_changes ENGINE=INNODB;      
ALTER TABLE sonar.active_rules ENGINE=INNODB;             
ALTER TABLE sonar.active_dashboards ENGINE=INNODB;        
ALTER TABLE sonar.action_plans ENGINE=INNODB;
三、服务端分析项目时或Eclipse本地分析时报
Caused by: org.sonar.api.utils.SonarException: The plugin findbugs is not supported with Java 1.6.0_**
由于最新版本的findbugs插件需要JDK1.7及以上的支持,因此需要安装JDK1.7以上
对于Eclipse,若不想改变系统的JAVA环境,而只改变Eclipse中的JAVA环境,则可在eclipse.ini文件中增加
-vm
%JAVA1.7_HOME%/bin/javaw.exe

SonarQube升级,布布扣,bubuko.com

SonarQube升级

标签:sonar   sonarqube   升级   mysql   innodb   

原文地址:http://blog.csdn.net/hunterno4/article/details/38688425

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!