October 25, 2012

限制MySQL Binlog的传输速率

最近一台核心库备库完成恢复后打开slave,导致主库传送binlog,瞬间占满网络,触发故障。 为了做一些限制, 给mysql在发送binlog的函数(mysql_binlog_send)里每隔一段时间sleep一次, 增加了两个参数: master_send_count  每读master_send_count次事件,sleep一次 master_send_sleep   每次sleep的时间为master_send_sleep ,单位为毫秒ms 以下统计数据,每1秒统计一次。 1.不受限制 set global master_send_count = 0; set global master_send_sleep = 0; 2.  set global master_send_count = 10; set global master_send_sleep = 100; 3. set global master_send_count = 10; set global master_send_sleep = 200; 4. set global master_send_count = 1; set global master_send_sleep = 15; 5. […]