- client
- 數台機器定時向 MySQL database 取得資料。
- windows 2008 R2 standard
- .net 2.0 sp2
- c#
- db server
- MySQL 5.0.45
- windows 2008 R2 standard
[狀況]
突然間(about 2am. orz),有一台機器連不到 MySQL,但其他機器仍正常運作。
MySql.Data.MySqlClient.MySqlException: Host 'xxx' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 在 MySql.Data.MySqlClient.PacketReader.CheckForError()
在 MySql.Data.MySqlClient.NativeDriver.Open()
在 MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
在 MySql.Data.MySqlClient.MySqlPool.GetConnection()
在 MySql.Data.MySqlClient.MySqlConnection.Open()
在 SQLDB.MySQLNativeDB.reCreateSqlCommand() 位置 D:\projects\vs2008\source\MatchEngine\Scupio2.0\SQLDB\MySQLNativeDB.cs:行号 132
在 SQLDB.MySQLNativeDB.ExecuteCmdNonQuery(String sqlcmd, IDataParameter[] parameters) 位置 D:\projects\vs2008\source\MatchEngine\Scupio2.0\SQLDB\MySQLNativeDB.cs:行号 86
這個例外訊息看起來蠻明確的: 機器 xxx 被 MySQL db server 擋(block)了。
網路上也有許多相關的問題與解法。查了 MySQL 文件,當某一台機器要求失敗的次數超過(max_connect_errors)時,mysqld 就會認定機器有問題了(something wrong):
Aftermax_connect_errors
failed requests without a successful connection, mysqld assumes that something is wrong (for example, that someone is trying to break in), and blocks the host from further connections until you issue aFLUSH HOSTS
statement or execute a mysqladmin flush-hosts command.
By default, mysqld blocks a host after 10 connection errors. You can adjust the value by settingmax_connect_errors
at server startup...
max_connect_error 可以下 sql command 看到: select variables; 而其預設值為 10。
- http://dev.mysql.com/doc/refman/5.5/en/blocked-host.html
- http://dev.mysql.com/doc/refman/5.5/en/flush.html
- > mysqladmin -uroot -p12345 flush-hosts
(ps: 12345 is password of root account.)
[thinking]
目前,我還不知道。
僅記以供參考。
0 意見:
張貼留言