OCP如何强制删除已停止且不可用集群信息

OCP版本436
ob版本425.7

在 OCP 4.3.5 版本中,对于已停止且不可用的集群,仅能通过删除元数据的方式进行处理。
需要处理哪些系统表

7 个赞

获取集群 ID:

OCP 平台上 OB 集群的 ID 可从浏览器地址栏获取,例如 URL 中的 10000018 即为 ob_cluster_id


二、操作步骤

Step 1:根据 ob_cluster_id 删除集群相关元数据

根据 OCP 的 ob_cluster_id 删除以下表中的记录:

| 表名 | 说明 |

|------|------|

| ob_cluster | 集群基本信息 |

| ob_server | 集群服务器信息 |

| ob_tenant | 集群租户信息 |

| ob_zone | 集群 Zone 信息 |

| ob_unit | 集群资源单元信息 |

| ob_unit_config | 资源单元配置信息 |

| ob_resource_pool | 资源池信息 |


-- 示例(根据实际 ob_cluster_id 替换)

DELETE FROM ob_cluster WHERE ob_cluster_id = <your_cluster_id>;

DELETE FROM ob_server WHERE ob_cluster_id = <your_cluster_id>;

DELETE FROM ob_tenant WHERE ob_cluster_id = <your_cluster_id>;

DELETE FROM ob_zone WHERE ob_cluster_id = <your_cluster_id>;

DELETE FROM ob_unit WHERE ob_cluster_id = <your_cluster_id>;

DELETE FROM ob_unit_config WHERE ob_cluster_id = <your_cluster_id>;

DELETE FROM ob_resource_pool WHERE ob_cluster_id = <your_cluster_id>;


Step 2:清理脏数据(如存在)

若存在脏数据,根据 host_id 删除以下表:

| 表名 | 说明 |

|------|------|

| compute_host | 计算节点信息 |

| compute_host_process | 计算节点进程信息 |

| compute_host_service | 计算节点服务信息 |


-- 示例(根据实际 host_id 替换)

DELETE FROM compute_host WHERE host_id = <your_host_id>;

DELETE FROM compute_host_process WHERE host_id = <your_host_id>;

DELETE FROM compute_host_service WHERE host_id = <your_host_id>;


Step 3:清理 exporter 地址

根据 instance 的 ip 删除 ocp_exporter_address 表:


-- 示例(根据实际 ip 替换)

DELETE FROM ocp_exporter_address WHERE ip = '<your_ip>';


三、注意事项

  1. 操作前请备份 OCP 数据库,防止误删导致数据丢失。

  2. 确认目标集群确实已停止且不可恢复后再执行删除操作。

  3. 删除顺序建议按照 Step 1 → Step 2 → Step 3 依次执行。

5 个赞

实用

2 个赞

不错,学习了

3 个赞

不是必要删的,就留着。

非常有深度的一篇好文,点赞支持。

签到…