connect-timeout=60Выполни sql запрос
SQL:2 set global wait_timeout = укажи нужный таймаут точку с запятой в конце оставь; set global interactive_timeout = укажи нужный таймаут точку с запятой в конце оставь;
Ну и не забудь указать в файле, иначе значения сбросятся /etc/mysql/my.cnf, в блоке mysqld:
[mysqld]
wait_timeout = твоё значение
interactive_timeout = твоё значение
Посмотреть текущее значение можно подключившись к mysql и выполнить следующие:
mysql -u USER -p
show variables like "wait_timeout";
show variables like "interactive_timeout";
quit;
interactive-timeout=30000
wait-timeout=30000
# This is the name of the DataSource class provided by the JDBC driver.
# Consult the documentation for your specific JDBC driver to get this class name.
dataSourceClassName = org.mariadb.jdbc.MariaDbDataSource
# This property controls the maximum number of milliseconds that a client (that's you) will wait for a connection from the pool.
# If this time is exceeded without a connection becoming available, an SQLException will be thrown.
connectionTimeout = 60000
# This property controls the maximum amount of time (in milliseconds) that a connection is allowed to sit idle in the pool.
# Whether a connection is retired as idle or not is subject to a maximum variation of +30 seconds, and average variation of +15 seconds.
# A connection will never be retired as idle before this timeout.
# A value of 0 means that idle connections are never removed from the pool.
# Default: 600000 (10 minutes)
idleTimeout = 600000
# This property controls the amount of time that a connection can be out of the pool before a message is logged indicating
# a possible connection leak. A value of 0 means leak detection is disabled.
# While the default is 0, and other connection pool implementations state that leak detection is "not for production"
# as it imposes a high overhead, at least in the case of HikariCP the imposed overhead is only 5?s (microseconds)
# split between getConnection() and close(). Maybe other pools are doing it wrong,
# but feel free to use leak detection under HikariCP in production environments if you wish.
leakDetectionThreshold = 0
# This property controls the maximum lifetime of a connection in the pool.
# When a connection reaches this timeout, even if recently used, it will be retired from the pool.
# An in-use connection will never be retired, only when it is idle will it be removed.
# We strongly recommend setting this value, and using something reasonable like 30 minutes or 1 hour.
# A value of 0 indicates no maximum lifetime (infinite lifetime), subject of course to the idleTimeout setting.
# Default: 1800000 (30 minutes)
maxLifetime = 900000
# This property controls the maximum size that the pool is allowed to reach, including both idle and in-use connections.
# Basically this value will determine the maximum number of actual connections to the database backend.
# A reasonable value for this is best determined by your execution environment.
# When the pool reaches this size, and no idle connections are available,
# calls to getConnection() will block for up to connectionTimeout milliseconds before timing out.
maximumPoolSize = 2500
при таких конфигурациях, все так же
16:04:24 HikariPool-2 - Failed to validate connection org.mariadb.jdbc.MariaDbConnection@71763958 (Connection.setNetworkTimeout cannot be called on a closed connection). Possibly consider using a shorter maxLifetime value.