When backing up MySQL database/database users, JetBackup utilizes the mysqldump
command which opens up connections in MySQL to dump the databases for each account. The number of connections used depends on the Concurrent Backup Tasks set (This tells JetBackup the number of accounts it can simultaneously backup at the same time).
If you notice websites hosted on your server show the following error:
"Error establishing a database connection"
It may be due to hitting a MySQL connection limit during the backup job. Checking /var/log/mysqld.log,
you should see similar error messages:
2021-10-29 12:00:01 12052603 [Warning] Aborted connection 12052603 to db: 'db1' user: 'db_user1' host: 'localhost' (Got an error writing communication packets) 2021-10-29 17:30:12 11892638 [Warning] Aborted connection 11892638 to db: 'db2' user: 'db_user2' host: 'localhost' (Got an error reading communication packets) 2021-10-29 10:21:01 13348777 [Warning] Aborted connection 13348777 to db: 'db3' user: 'db_user3' host: 'localhost' (Got an error reading communication packets) -- 2021-10-30 16:00:07 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) 2021-10-30 16:00:08 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) 2021-10-30 16:00:01 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections) 2021-10-30 16:00:01 0 [Warning] Aborted connection 0 to db: 'unconnected' user: 'unauthenticated' host: 'connecting host' (Too many connections)
According to MySQL documentation, the "Too many connections" error occurs when all available connections are in use and is controlled by the "max_connections" variable.
If clients encounter Too many connections errors when attempting to connect to the mysqld server, all available connections are in use by other clients.
The permitted number of connections is controlled by the max_connections system variable. To support more connections, set max_connections to a larger value.
https://dev.mysql.com/doc/refman/8.0/en/too-many-connections.html
You can check the number of open connections and your max connection limit by logging into your MySQL database and running the following commands:
MariaDB [(none)]> show processlist;
+----------+---------+-----------+--------+---------+-------+-----------+---- -----------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+----------+---------+-----------+--------+---------+-------+-----------+----------------+----------+
<snipped>
+----------+---------+-----------+--------+---------+-------+-----------+----------------+----------+
99 rows in set (0.000 sec)
MariaDB [(none)]> show variables like 'max_connections';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| max_connections | 100 |
+-----------------------+-------+
1 row in set (0.001 sec)
On the example above, we see that there are 99 active connections (99 rows in set) when checking the processlist and the MySQL database has a limit of 100
max_connections
which may cause this issue. We recommend checking with your qualified server administrator if it's advisable to increase your limit depending on your server resources.