暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

rebalance优先级的基本用法

VV_刺头王 2022-01-18
357

本篇主要围绕设置rebalance任务的优先级展开描述。

1、首先需要设置参数gcluster_rebalancing_concurrent_count=0,将当前允许执行的rebalance任务数设置为零,意为阻止任务被执行;

2、然后利用rebalance instance/database/table等把当前需要数据重分布的表加入到系统表gclusterdb.rebalancing_status中;

查看rebalance状态

gbase> select index_name, status, percentage,priority  from gclusterdb.rebalancing_status;

+------------+-----------+------------+------------+
| index_name | status | percentage | priority
+------------+-----------+------------+------------+
|   test.t1    | STARTING |        0      |       5

|   test.t2    | STARTING |        0      |       5

|   test.t3    | STARTING |        0      |       5

|   test.t4    | STARTING |        0      |       5

+------------+-----------+------------+------------+
4 rows in set (Elapsed: 00:00:00.04)

3、调整每个表的 rebalance 任务的优先级;

update gclusterdb.rebalancing_status set priority = <priority_value> where index_name='database_name.table_name';

其中,priority_value为指定的优先级值,默认是5,范围为int数值类型范围;

举例:

gbase> update gclusterdb.rebalancing_status set priority = 6 where index_name='test.t3';
Query OK, 1 row affected
Rows matched: 1 Changed: 1 Warnings: 0

gbase> update gclusterdb.rebalancing_status set priority = 4 where index_name='test.t2';
Query OK, 1 row affected
Rows matched: 1 Changed: 1 Warnings: 0

gbase> update gclusterdb.rebalancing_status set priority = 0 whereindex_name='test.t1';
Query OK, 1 row affected

Rows matched: 1 Changed: 1 Warnings: 0

gbase> select index_name, status, priority from gclusterdb.rebalancing_status;
+------------+----------+----------+
| index_name | status | priority |
+------------+----------+----------+
| test.t1 | STARTING | 0 |

| test.t2 | STARTING | 4 |

| test.t3 | STARTING | 6 |

| test.t4 | STARTING | 5 |

+------------+----------+----------+
4 rows in set

4、设置gcluster_rebalancing_concurrent_count 为需要的并发数,然后rebalance任务就可以按照并发数和优先级顺序执行;

gbase> set global gcluster_rebalancing_concurrent_count = 1;
Query OK, 0 rows affected
gbase> select index_name, status, priority from gclusterdb.rebalancing_status;
+------------+----------+----------+
| index_name | status | priority |
+------------+----------+----------+
| test.t3 | STARTING | 6 |

| test.t2 | STARTING | 4 |

| test.t1 | RUNNING | 0 |

| test.t4 | STARTING | 5 |
+------------+----------+----------+
4 rows in set

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论