|
|
Seconds_Behind_Master: 7600
}1 M) I$ G; q3 A: l1 ~
) C; b- F! W- T" b5 `3 f- x3 Y1, 检查show full processlist; 没有任何slow的dml sql语句。
2 j5 \- l3 ]9 `2, 检查innodb status,没有任何lock的块。
; _7 a3 X }7 i. D, Q* o! `3, 检查cacti,里面cpu usage从4%上升到了15%,Percona InnoDB I/O GT 从90%降低到了50%%。8 o" R' [/ K1 b1 M% @4 A
4, 检查当前connections,发现处于业务低峰期。
. e8 {. |. i% m" E% p5, 尝试我重启了下mysql server,结果Seconds_Behind_Master还是不停的增长。
. _# }) r. }* E! L* U0 x$ U0 N' G3 W
6,最后去检查写入参数看下:
. v. [, i( R, I2 p9 _# F6 mmysql> show variables like '%commit%';* q+ y/ B# v# V3 D1 y
+--------------------------------+-------+5 f" n$ j! g% O# ?' A
| Variable_name | Value |
8 v9 `: l* F0 j4 R* i) Y7 h( D+--------------------------------+-------+$ P5 w: S7 F' A I: ~& d
| autocommit | ON |; G6 Q, T0 f5 z
| innodb_commit_concurrency | 0 |4 D( x* z9 M: t% @
| innodb_flush_log_at_trx_commit | 0 |
0 V; ~; F, g* S5 A+--------------------------------+-------+
4 _. i9 `' v7 T, T: v3 rows in set (0.00 sec)
7 ~7 [& g2 @. U, a/ o7 Q" a( A% u( A
commit为0,已经算是最快的了。
f/ p; p4 A. a再看binlog
4 R/ l3 ?+ @+ b2 j4 |5 amysql> show variables like 'sync_binlog';: [' k, |8 x/ ?- L5 p
+---------------+-------+
( x7 K% i3 A7 r) ~( g0 A7 A| Variable_name | Value |% g3 E1 d2 G2 F6 M% \. @/ c
+---------------+-------+; R6 |! q; ^9 x& W% F- V
| sync_binlog | 2 |
# F S% z2 d0 R) l+---------------+-------+9 W4 g" h( M, X g
1 row in set (0.00 sec)
Y) u: T9 {- z) y/ s- F& k P+ y: O/ S. ~
那么改成0试试看吧。; F1 S) Y( q% t7 j" F
set global sync_binlog=0;& C P) ?: _; O! m2 u
, |4 \# H1 _, @9 I2 a' S
执行完后,从Seconds_Behind_Master: 9200变成了Seconds_Behind_Master: 8791,开始追了。' f, U7 U4 o7 U6 g
又过了3分钟,已经是Seconds_Behind_Master: 0了。 C% }. O9 v$ d. y G/ o
虽然问题解决了,但是主要问题不在sysn_binlog,估计是磁盘有问题了,不然不可能在晚上业务低峰期,会主从delay的。平常白天业务高峰期都没有主从delay过,把疑惑发给山姆大叔,让他去找system administrator吧,去check下disk的问题。 |
|