LoginSignup
0
2

More than 5 years have passed since last update.

zabbix-proxyでMySQL server has gone awayが出る対処

Last updated at Posted at 2017-07-11

gone awayとかいわれてビビるけどそんなに致命的ではなかった備忘録。

軽くググった感じでは
http://tech.g.hatena.ne.jp/rx7/20100708/p1
とか
http://qiita.com/RyutaKojima/items/3772d695db5e2342ab47
こんな感じでtimeoutがらみのようでありました。

挨拶がわりにnetstatでListenしてるポートをみる

# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      1970/mysqld         
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1225/rpcbind        
tcp        0      0 0.0.0.0:4949                0.0.0.0:*                   LISTEN      22120/perl          
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      16478/zabbix_agentd 
tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      2857/zabbix_proxy   
tcp        0      0 0.0.0.0:1220                0.0.0.0:*                   LISTEN      1324/sshd           
tcp        0      0 :::111                      :::*                        LISTEN      1225/rpcbind        
tcp        0      0 :::1220                     :::*                        LISTEN      1324/sshd           

・ログみると一分おきにでていた

# tail -f /var/log/zabbix/zabbix-proxy.log
2868:20170711:102306.839 [Z3005] query failed: [2006] MySQL server has gone away [select hostid,status from hosts where host='xxx-http01' and status in (0,1) and proxy_hostid=0]  

2871:20170711:102400.810 [Z3005] query failed: [2006] MySQL server has gone away [select hostid,status from hosts where host='xxx-backup01' and status in (0,1) and proxy_hostid=0]

気にしなくてもいいしwait_timeout伸ばしてもいいかなって感じみたい。
http://www.zabbix.jp/node/3209

・ちょっとパラメータを確認

# mysql -u root -p

mysql> show global variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 60    |
+---------------+-------+
1 row in set (0.00 sec)
mysql> show global variables like 'interactive_timeout';
+---------------------+-------+
| Variable_name       | Value |
+---------------------+-------+
| interactive_timeout | 28800 |
+---------------------+-------+
1 row in set (0.00 sec)

mysql> show global variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| max_allowed_packet | 16777216 |
+--------------------+----------+
1 row in set (0.00 sec)

・mysqltunerでいちおう確認

一応見たがまずそうなサジェストは出てなかった。

・値を変えてみる(オンライン)

mysql> set global wait_timeout=3600;
Query OK, 0 rows affected (0.00 sec)

mysql> set global interactive_timeout=3600;
Query OK, 0 rows affected (0.00 sec)

mysql> show global variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 3600  |
+---------------+-------+
1 row in set (0.00 sec)
mysql> show global variables like 'interactive_timeout';
+---------------------+-------+
| Variable_name       | Value |
+---------------------+-------+
| interactive_timeout | 3600  |
+---------------------+-------+
1 row in set (0.00 sec)

・様子をみる
一分おきには出なくなった。

# tail -f /var/log/zabbix/zabbix-proxy.log

・まだでるので一応SQL文の最大長も広げる

mysql> set global max_allowed_packet=33554432;
Query OK, 0 rows affected (0.00 sec)

mysql> show global variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name      | Value    |
+--------------------+----------+
| max_allowed_packet | 33554432 |
+--------------------+----------+
1 row in set (0.00 sec)

どこまで増やせるか的な情報↓
http://nippondanji.blogspot.jp/2009/05/mysql.html

・my.cnfも変えとく(再起動後にも反映)

# cp -p /etc/my.cnf{,.`date +%Y%m%d`}
# vi /etc/my.cnf
# diff /etc/my.cnf{,.`date +%Y%m%d`}
21,22c21
< wait_timeout = 3600
< interactive_timeout = 3600
---
> wait_timeout = 60
29c28
< max_allowed_packet = 32M
---
> max_allowed_packet = 16M

・しばらく様子を見る

zabbix-proxyのログ以外にMySQL本体のerrorlogはとくに出てなかった。
追ってみてたら1時間くらい連続で出なくなってたので解決。

・そのたactive checksでhost not foundとか言われるログの対処

Sending list of active checks to [xxx.xxx.xxx.20] failed: host [xxx-zabbix01] not found

ホスト監視してないとかホスト名一致しないと出るやつ。
zabbix-server側にhosts登録及び監視ホスト登録して解消。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2