Connection to Bamboo Database is lost with error about host being blocked

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

症状

You are using MYSQL database, and all of a sudden Bamboo becomes inaccessible. The login page shows the following message

HTTP Error: 503
Problem accessing /bamboo: Reason
Service Unavailable

The BambooHome/logs/atlassian-bamboo.log shows the following:

2013-01-02 08:40:01,495 WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] [BasicResourcePool] com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5aa4215 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
	at sun.reflect.GeneratedConstructorAccessor19.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.Util.getInstance(Util.java:381)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2364)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:781)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
	at sun.reflect.GeneratedConstructorAccessor17.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:284)
	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
	at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
	at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: java.sql.SQLException: null,  message from server: "Host 'your_host' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1104)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2292)

原因

Your remote host is blocked because of many connection errors. By default, the max_connect_errors value is 10 and as such any reconnection trials more than 10 will cause a block on the host.

ソリューション

Please follow the following steps:

  1. Run mysqladmin flush-hosts on the server running MySQL server
  2. To avoid this from showing up again, increase the max_connect_errors value to a higher value say 200. This can be done by editing the file etc/my.cnf  (Linux) or my.ini (Windows) and adding the line set-variable = max_connect_errors=200 below the [mysqld] tag. An example file is shown below:

    [mysqld]
    datadir=/backup/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    set-variable = max_connections=500
    set-variable = max_connect_errors=200
    old_passwords=1
    safe-show-database
    skip-locking
    skip-innodb
    max_allowed_packet = 1M
    set-variable = table_cache=1024
    set-variable = query_cache_type=1
    set-variable = query_cache_limit=1M
    set-variable = query_cache_size=128M ## 32MB for every 1GB of RAM
    
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    
    [mysql]
    socket=/var/lib/mysql/mysql.sock
    
    [mysqladmin]
    socket=/var/lib/mysql/mysql.sock
    
    [mysqldump]
    socket=/var/lib/mysql/mysql.sock
    
    
最終更新日 2016 年 5 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.