简体   繁体   English

使用 Galera 集群在 MariaDB 中进行分区轮换

[英]Partition rotating in MariaDB with Galera cluster

How manage partition rotating in real time on Galera Cluster?如何在 Galera Cluster 上实时管理分区轮换?

I am catch from time to time metadata lock while dropping or adding partitions on a table.在表上删除或添加分区时,我不时捕获元数据锁定。 I have 3 nodes in a cluster and all application connections going to first node through load balance.我在一个集群中有 3 个节点,所有应用程序连接都通过负载平衡到达第一个节点。 If first node goes down connection switch to second node.如果第一个节点断开连接,则切换到第二个节点。

For partitioning I use the next SP:对于分区,我使用下一个 SP:

CREATE DEFINER=`root`@`localhost` PROCEDURE `manage_partitions`()
BEGIN
  if @@GLOBAL.wsrep_on = 1 
    then SET wsrep_on=0; end if;
  SET sql_log_bin = 0;
  ----- > Manage partitions here
  SET sql_log_bin = 1;
  if @@GLOBAL.wsrep_on = 1 
    then SET wsrep_on=1; end if;
END

I execute this piece of code on each node on different time.我在不同时间在每个节点上执行这段代码。 And some time catch metadata lock and only kill process which create/drop partition can unfreeze server.并且有一段时间捕获元数据锁定并且只有杀死创建/删除分区的进程才能解冻服务器。

So, DBAs, How you manage partition rotations in MariaDB with Galera clusetr in real time?那么,DBA,您如何使用 Galera clusetr 实时管理 MariaDB 中的分区轮换? I use MariaDB version - 10.1.13.我使用 MariaDB 版本 - 10.1.13。

Mike.迈克。

Does the problem happen if you only change sql_log_bin .如果您更改sql_log_bin是否会出现问题。 That is you do not turn off all replication via wsrep_on .也就是说,您没有通过wsrep_on关闭所有复制。 I feel that this should be the answer.我觉得这应该是答案。

Meanwhile, please show us the partition management code;同时,请给我们展示分区管理代码; there could be things to do there.那里可能有事情要做。

Are you essentially doing an RSU?你本质上是在做 RSU 吗? Would it work to do TOI?做TOI有用吗?

What if we can speed up the management so that TOI is feasible instead of RSU?如果我们可以加快管理速度,使 TOI 代替 RSU 可行呢?

If you are doing a "sliding time scale", it is quite possible to make the ALTER ... PARTITION commands virtually instantaneous.如果您正在执行“滑动时间刻度”,则很有可能使ALTER ... PARTITION命令几乎是瞬时的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM