FastNetMon

Monday 30 May 2011

Debian, MySQL 5.1 Perocna и работа с СУБД по tcp/ip сети: увеличивается Aborted_Connects

Имеем вот такой тестовый скрипт, запущенный на машине, которая подключается к удаленному MySQL серверу mysqlremoteserver.ru по сети:
for i in `seq 1 1000`; do echo -n "try $i"; mysqladmin ping -h mysqlremoteserver.ru -uv1 -pqwerty; if [ $? -ne 0 ]; then echo "not ok" ; fi ; done | grep -v 'alive'

И при запуске имеем следующие ошибки:
mysqladmin: connect to server at 'hostingmysqlserver' failed
error: 'Can't connect to MySQL server on 'hostingmysqlserver' (4)'
Check that mysqld is running on hostingmysqlserver and that the port is 3306.
You can check this by doing 'telnet hostingmysqlserver 3306'
try 12not ok
mysqladmin: connect to server at 'hostingmysqlserver' failed
error: 'Can't connect to MySQL server on 'hostingmysqlserver' (4)'
Check that mysqld is running on hostingmysqlserver and that the port is 3306.
You can check this by doing 'telnet hostingmysqlserver 3306'
try 199not ok
mysqladmin: connect to server at 'hostingmysqlserver' failed
error: 'Can't connect to MySQL server on 'hostingmysqlserver' (4)'
Check that mysqld is running on hostingmysqlserver and that the port is 3306.
You can check this by doing 'telnet hostingmysqlserver 3306'
try 201not ok
^Cmysqladmin: connect to server at 'hostingmysqlserver' failed
error: 'Can't connect to MySQL server on 'hostingmysqlserver' (4)'
Check that mysqld is running on hostingmysqlserver and that the port is 3306.
You can check this by doing 'telnet hostingmysqlserver 3306'


При этом увеличивается счетчик Aborted_connects:
show global status like 'Aborted%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| Aborted_clients | 4 |
| Aborted_connects | 113 |
+------------------+-------+
2 rows in set (0.00 sec)

Как отладить данную проблему и понять, почему происходит сброс коннекта?

В первую очередь стоит включить лог предупреждений, это делается путем добавления в блок [mysqld] файла /etc/mysql/my.cnf ниже указанного параметра и последующей перезагрузки mysql демона:
log-warnings

После этого открываем лог mysql демона и ждем появления ошибок про Abort_connect:
tail -f /var/log/daemon.log -n 1000

Со временем должны появится примерно такие записи:
May 30 12:32:55 mysql1 mysqld: 110530 12:32:55 [Warning] Aborted connection 87982 to db: 'dbsome' user: 'tesuser' host: 'domain.ru' (Got an error reading communication packets)

По которым можно будет сделать хоть какие-то выводы о том, где источник проблемы.

1 comment :

  1. MySQL 5.1 Perocna в заголовке - поправь опечатку

    ReplyDelete

Note: only a member of this blog may post a comment.