我们使用SonarQube 5.6.6运行连接到mysql数据库的docker容器。我们在数据库清理器中配置了默认设置。但是,我们最近发现数据库根本没有得到清理。
我找不到与数据库清理程序相关的任何日志条目。所以我无法弄清楚出了什么问题。
这是我们当前的数据库大小
MySQL [sonar]> SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables GROUP BY table_schema;
+--------------------+---------------+
| DB Name | DB Size in MB |
+--------------------+---------------+
| information_schema | 0.2 |
| sonar | 28842.6 |
+--------------------+---------------+
MySQL [sonar]> SELECT
-> table_name AS `Table`,
-> round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
-> FROM information_schema.TABLES
-> WHERE table_schema = 'sonar'
-> ;
+---------------------------+------------+
| Table | Size in MB |
+---------------------------+------------+
| active_dashboards | 0.05 |
| active_rule_parameters | 0.08 |
| active_rules | 0.34 |
| activities | 5.03 |
| authors | 0.03 |
| ce_activity | 2.06 |
| ce_queue | 0.05 |
| dashboards | 0.02 |
| duplications_index | 14.55 |
| events | 23.58 |
| file_sources | 11902.03 |
| group_roles | 0.20 |
| groups | 0.02 |
| groups_users | 0.06 |
| issue_changes | 24.53 |
| issue_filter_favourites | 0.03 |
| issue_filters | 0.03 |
| issues | 451.50 |
| loaded_templates | 0.02 |
| manual_measures | 0.03 |
| measure_filter_favourites | 0.03 |
| measure_filters | 0.03 |
| metrics | 0.08 |
| notifications | 0.02 |
| perm_templates_groups | 0.02 |
| perm_templates_users | 0.02 |
| permission_templates | 0.02 |
| project_links | 0.31 |
| project_measures | 11123.83 |
| project_qprofiles | 0.03 |
| projects | 1804.22 |
| properties | 0.03 |
| quality_gate_conditions | 0.02 |
| quality_gates | 0.03 |
| resource_index | 3049.98 |
| rules | 3.72 |
| rules_parameters | 0.17 |
| rules_profiles | 0.03 |
| schema_migrations | 0.02 |
| snapshots | 435.53 |
| user_roles | 0.05 |
| user_tokens | 0.05 |
| users | 0.11 |
| widget_properties | 0.03 |
| widgets | 0.05 |
+---------------------------+------------+
45 rows in set (0.00 sec)
如何手动清理数据库? 提前感谢您提供任何提示。
答案 0 :(得分:0)
我认为对于数据库清理器属性仅在再次分析项目时才起作用,即仅在下一次SonarQube分析时根据属性清除特定项目的db。
确保检查是否删除了再次分析的项目的快照。
建议:尝试使用SonarQube ReST API删除将在内部清理数据库的项目。用于删除项目的SonarQube API:
HTTP POST
<SonarQubeBaseURL>/api/projects/delete?id=project_id
提醒您,您可以通过SonarQube服务器上的此网址<SonarQubeBaseURL>/web_api/
获取SonarQube API的文档。