MySQL: 1040, 'Too many connections' exception
If Hue displays the "1040, Too many connections" exception, then it is possible that
the Hue backend database is overloaded and out of maximum available connections. To resolve
this issue, you can increase the value of the max_connections
property for
your database.
The 1040, 'Too many connections' exception occurs on a MySQL database when it runs
out of maximum available connections. If you are using the Impala engine, you may
see the following error message on the Hue web interface: OperationalError
at /desktop/api2/context/computes/impala("1040: too many connections")
.
A similar error may be displayed for Hive. The exception is also captured in the Hue
server logs.
max_connections
property defines the
maximum number of connections that a MySQL instance can accept. Uncontrolled number of
connections can crash the server. Following are some guidelines for tuning the value of
the max_connections
property:- Set the value of the
max_connections
property according to the size of your cluster. - If you have less than 50 hosts, then you can store more than one database (for example, both the Activity Monitor and Service Monitor) on the same host. If you have more than 50 hosts, then use a separate host for each database/host pair. The hosts need not be reserved exclusively for databases, but each database must be on a separate host.
- For less than 50 hosts:
- Place each database on its own storage volume.
- Allow 100 maximum connections for each database and then add 50 extra connections. For example, for two databases, set the maximum connections to 250. If you store five databases on one host (the databases for Cloudera Manager Server, Activity Monitor, Reports Manager, Atlas, and Hive MetaStore), then set the maximum connections to 550.
To increase the number of maximium available connections and to resolve the "1040, Too many connections" exception: