gpt4 book ai didi

mysql - Sonar 数据库清理

转载 作者:行者123 更新时间:2023-11-30 21:54:46 28 4
gpt4 key购买 nike

我们使用 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)

如何手动清理数据库?预先感谢您的任何提示。

最佳答案

我认为对于数据库清理器属性只有在再次分析项目时才有效,即仅在下一次 SonarQube 分析时根据属性为特定项目清理数据库。

确保检查是否删除了再次分析的项目的快照。

建议:尝试使用 SonarQube ReST API 删除将在内部清理数据库的项目。用于删除项目的 SonarQube API:

HTTP POST
<SonarQubeBaseURL>/api/projects/delete?id=project_id

作为提醒,您可以通过访问此 url <SonarQubeBaseURL>/web_api/ 来获取 SonarQube API 的文档。在您的 SonarQube 服务器上。

关于mysql - Sonar 数据库清理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45669752/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com