Help Center> MapReduce Service> Troubleshooting> Using Hive> Connection Timed Out During SQL Statement Execution on the Hive Client
Updated on 2023-11-30 GMT+08:00

Connection Timed Out During SQL Statement Execution on the Hive Client

Symptom

The Hive client fails to execute SQL statements, and error message "Timed out waiting for a free available connection" is displayed.

Cause Analysis

There are a large number of DBService connections, and obtaining the connections times out.

Procedure

  1. Check whether the client uses the Spark SQL client to execute SQL statements.

    • If yes, check the timeout parameter in the URL, change the value to 600, and go to 7.
    • If no, go to 2.

  2. Log in to Manager, choose Cluster > Services > Hive > Configurations > All Configurations, search for javax.jdo.option.ConnectionURL, and check whether the value of the timeout parameter is less than 600.

    Hive, HiveServer, MetaStore, and WebHCat all have this parameter. Ensure that their parameter values are the same.

    • If yes, go to 3.
    • If no, go to 7.

  3. Check whether the value of javax.jdo.option.ConnectionURL is ${javax.jdo.option.ConnectionURL.default}.

    • If yes, go to 4.
    • If no, change the timeout parameter in the URL to 600, click Save, and go to 7.

  4. Click Instance, select any HiveServer instance, and log in to the instance node as user root.
  5. Open the ${BIGDATA_HOME}/FusionInsight_Current/*HiveServer/etc/hivemetastore-site.xml configuration file, find the javax.jdo.option.ConnectionURL parameter, and copy its value.

  6. Log in to Manager, choose Cluster > Services > Hive > Configurations > All Configurations, search for javax.jdo.option.ConnectionURL, change its value to the URL copied in 5, change the timeout parameter to 600, and click Save.

    Hive, HiveServer, MetaStore, and WebHCat all have this parameter. Ensure that their parameter values are the same.

  7. Choose Cluster > Services > Hive > Configurations > All Configurations, search for maxConnectionsPerPartition, and check whether its value is less than 100.

    • If yes, change the value to 100, click Save, and go to 8.
    • If no, go to 8.

  8. If parameters are modified in the preceding steps, choose Cluster > Services > Hive > Dashboard, click More, and select Service Rolling Restart. If no parameters are modified, skip this step.