[Mysql] Mysql slave restarts at regular intervals
Background: the slave replication process stops every once in a while from the HuaYun_Interface-SLAVE slave library, and zabbix sends alarm messages.
Mysql > show slave status\ G
* * 1. Row *
Slave_IO_State:
Master_Host: *
Master_User: repl
Master_Port: 3307
Connect_Retry: 60
Master_Log_File: mysql-bin.000195
Read_Master_Log_Pos: 629275501
Relay_Log_File: mysql-relay-bin.000521
Relay_Log_Pos: 625430128
Relay_Master_Log_File: mysql-bin.000195
Slave_IO_Running: No
Slave_SQL_Running: No
Check the mysql error log when stopping, and we find a clue.
2016-06-23 14:06:56 32289 [Warning] 'proxies_priv' entry' @ root@sh275' ignored in-skip-name-resolve mode.
160623 15:03:49 mysqld_safe Number of processes running now: 0
160623 15:03:49 mysqld_safe mysqld restarted-found that the mysql service was restarted, and we configured skip_slave_start (prevents the repl process from automatically restarting), so the replication process is in the down state
2016-06-23 15:03:50 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).
2016-06-23 15:03:50 0 [Note] / home/data/mysql/bin/mysqld (mysqld 5.6.24-log) starting as process 22569.
2016-06-23 15:03:50 22569 [Note] Plugin 'FEDERATED' is disabled.
2016-06-23 15:03:50 22569 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-06-23 15:03:50 22569 [Note] InnoDB: The InnoDB memory heap is disabled
2016-06-23 15:03:50 22569 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-06-23 15:03:50 22569 [Note] InnoDB: Memory barrier is not used
2016-06-23 15:03:50 22569 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-06-23 15:03:50 22569 [Note] InnoDB: Using Linux native AIO
2016-06-23 15:03:50 22569 [Note] InnoDB: Not using CPU crc32 instructions
2016-06-23 15:03:50 22569 [Note] InnoDB: Initializing buffer pool, size = 10.0G
2016-06-23 15:03:51 22569 [Note] InnoDB: Completed initialization of buffer pool
At the same time, we check the email sent by zabbix, and there is a linux host memory alarm notification.
Alarm host: _ HuaYun_Interface-SLAVE
Host IP: *
Alarm time: 15:08:06 on June 23, 2016
Alarm level: Average
Alarm message: Lack of available memory on server HuaYun_Interface-SLAVE
Question details: Available memory:163.15 MB
Event ID: 42590
Log on to the mainframe for inspection
[root@NEW-APP-MYSQL-SLAVE ~] # dmesg
Out of memory: Kill process 32289 (mysqld) score 966 or sacrifice child
Killed process 32289, UID 498, (mysqld) total-vm:14630648kB, anon-rss:7711284kB, file-rss:360kB [root@NEW-APP-MYSQL-SLAVE] # free-m
Total used free shared buffers cached
Mem: 7872 7747 124 0 124 1331
-/ + buffers/cache: 6292 1580
Swap: 2047 56 1991
It is obvious that there is an OOM killer phenomenon caused by insufficient memory in linux. There is no way to increase the memory of the host.