简体   繁体   English

复制问题

[英]Replication issue

We have a one master and two VIP slave database servers. 我们有一台主服务器和两台VIP从数据库服务器。 We changed data type of column from VARCHAR(255) to TEXT on master. 我们在master上将列的数据类型从VARCHAR(255)更改为TEXT。 The application is currently configured to use master only for writing operations and configured slaves for reading operation. 该应用程序当前配置为仅使用主设备进行写入操作,而配置了从设备进行读取操作。 After changing the data type on master server using ALTER TABLE command the slave server becomes unresponsive. 使用ALTER TABLE命令更改主服务器上的数据类型后,从服务器将无响应。 We are using Mariadb 10.0 [PROCESSES INFORMATION] 我们正在使用Mariadb 10.0 [过程信息]

Id  User    Host    Db  Command Time(sec)   State   Info
-----------------------------------------------------------------------
203739  repl    slave1      Binlog Dump 75,143,121  Master has sent all binlog to slave; waiting for binlog to be updated   

203740  repl    slave2      Binlog Dump 75,143,121  Master has sent all binlog to slave; waiting for binlog to be updated

The slave instance becomes very slow due to slow queries. 从属实例由于查询缓慢而变得非常慢。 number of sessions: 1590 thread_pool_max_thread=500 Current value =648 会话数:1590 thread_pool_max_thread = 500当前值= 648

After performing ALTER TABLE on Master server, it was replicating to slave server and in the same time number of sessions were get increased rapidly on slave server. 在主服务器上执行ALTER TABLE之后,它正在复制到从服务器上,与此同时,从服务器上的会话数也迅速增加。 I think slaves becomes unresponsive because of slow queries. 我认为由于查询速度慢,奴隶变得反应迟钝。

But I don't know why this queries became so slow and slaves got unresponsive. 但是我不知道为什么这个查询变得如此缓慢,而奴隶却没有响应。 The DBA's saying that after executing ANALYZE TABLE command, the issue has been solved. DBA的说法是,在执行ANALYZE TABLE命令之后,该问题已解决。 But I don't understand why this happened because ANALYZE TABLE only update the statistic information. 但是我不明白为什么会这样,因为ANALYZE TABLE仅更新统计信息。 It would be helpful if anyone comment on this why it happened? 如果有人对此事发表评论,这将很有帮助? How to avoid such issues in future. 将来如何避免此类问题。

There is one minor case where TEXT is slower than VARCHAR . 在少数情况下, TEXTVARCHAR慢。 When a SELECT needs to build a temporary table (often for sorting due to GROUP BY or ORDER BY ), it first tries to build a MEMORY table. SELECT需要建立一个临时表时(通常是由于GROUP BYORDER BY进行排序),它首先尝试建立一个MEMORY表。 But, TEXT and BLOB prevent it from using such, so it uses MyISAM instead. 但是, TEXTBLOB阻止它使用它,因此它改用MyISAM This is slower (but gets the job done). 这比较慢(但是可以完成工作)。

I say this is a "minor case" because users rarely identify it with phrases like "very slow" and "becomes unresponsive". 我说这是“次要情况”,因为用户很少用“非常慢”和“变得无反应”之类的短语来识别它。 I would guess that a SELECT might run twice as slow. 猜想 SELECT可能会慢一倍。

Also, the ANALYZE TABLE discussion does not hold water. 同样,“ ANALYZE TABLE讨论也不成立。 Again it may be coincidence, not causation. 同样,这可能是巧合,而不是因果关系。

So, the change to TEXT may be a 'red herring'. 因此,对TEXT的更改可能是“红鲱鱼”。 Instead, let's discover what is being slow by using the slowlog. 取而代之的是,让我们通过使用slowlog发现正在变慢的东西。 See this for what I like to work from. 对我喜欢的工作。

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

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