暂无图片
【OB学习笔记】OB表分区迁移、切主
最近更新:2023-07-28 16:05:44

适用范围

OCEANBASE PARTITION迁移、切主

方案概述

在性能优化(避免分布式执行计划、负载均衡等)、处理个别问题时,可能有分区级切主、不同OBSERVER间移动分区副本或切主副本的需求,操作方法如下

实施步骤

1、查询主副本所在OBSERVER,table_id,partition_id,partition_cnt信息

MySQL [oceanbase]> SELECT table_id,partition_id,svr_ip,role FROM oceanbase.__all_virtual_meta_table WHERE table_id in (select a.table_id from oceanbase.__all_virtual_table a,oceanbase.__all_virtual_database b where a.tenant_id=b.tenant_id and a.database_id=b.database_id and b.database_name='TEST' and table_name='TA2') and role=1;

+------------------+--------------+----------------+------+
| table_id         | partition_id | svr_ip         | role |
+------------------+--------------+----------------+------+
| 1105009186203925 |            0 | 192.168.1.73  |    1 |<<<
| 1105009186203925 |            1 | 192.168.1.73  |    1 |
......