Configuring graceful shutdown property for HiveServer

Learn how to configure the graceful shutdown timeout property for HiveServer (HS2), which ensures that HS2 waits for a specified time period before shutting down, thereby allowing queries that are already running to complete before HS2 stops.

By default, the graceful shutdown timeout property is set to 5 minutes. Queries that are still running beyond the timeout period are aborted and will have to be manually submitted by the user because HS2 cannot automatically resubmit these queries.

You must also know that submitting new queries or starting a new session during a HS2 graceful shutdown will fail. Also, if there are no active queries during the graceful shutdown, HS2 stops in 30 seconds instead of waiting 5 minutes for all the live sessions to close.

You can modify the graceful shutdown timeout property based on a customer's usage, for example, you can choose to increase the timeout property if the customer has long running queries.

The HS2 graceful shutdown is initiated during a Cloudera Runtime Rolling Upgrade, Rolling Restart, can be triggered by stopping HS2 in Cloudera Manager, or by running the hive --service hiveserver2 --graceful_stop command.

  1. In Cloudera Manager, click Clusters and select the Hive on Tez service.
  2. From the Hive on Tez service, go to the Configuration tab and search for hive.server2.graceful.stop.timeout.

    Property to configire graceful shutdown for HiveServer
  3. Modify the graceful timeout value. By default, the timeout value is set to 5 minutes.
  4. Click Save Changes and restart the Hive on Tez service.
The changes do not take effect during the first HS2 restart and the graceful timeout value that was specified prior to the change is considered for the graceful shutdown. The new changes take effect only from the second restart.

For example, if the timeout value was changed from 5 minutes to 10 minutes, the first HS2 restart considers the 5 minute timeout for the graceful shutdown. The second HS2 restart will consider the 10 minute timeout value.