1040, 'Too many connections' exception
If Hue abruptly 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. 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.
- 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 do not need to be reserved exclusively for databases, but each database should be on a separate host.
- For less than 50 hosts:
- Put 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, Cloudera Navigator, 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:
- Log in to Cloudera Manager and stop the Hue service.
- SSH in to your database instance as a root user.
- Check the number of available connections by running the following command:
grep max_conn /etc/my.cnf/etc/my.cnf is the default location of the options file (my.cnf).
- Set the new value of the max_connections property from the MySQL shell as per the guidelines provided above. For
mysql> SET GLOBAL max_connections = 550;
- Restart the Hue service.