Initiating automatic compaction in Cloudera Manager

Several properties in the Hive and Hive metastore service configurations must be set to enable automatic compaction. You need to check that the property settings are correct and to add one of the properties to the Hive on Tez service. Automatic compaction will then occur at regular intervals, but only if necessary.

Initiator threads should run in only one metastore server/HA configuration. Disable Initiator threads in other metastore server/HA configurations. The following properties must be set in Hive metastore (Hive-1) and Hive on Tez services as follows:
  • hive.compactor.initiator.on = true (default)
  • hive.compactor.worker.threads = <a value greater than 0> (default and recommended value = 5)
  • hive.metastore.runworker.in = hs2 (default)

You must run the compactor initiator on only one HMS instance at a time.

Tables or partitions you are compacting must be full ACID or insert-only ACID tables.
  1. In Cloudera Manager, select the Hive metastore service: Clusters > Hive-1 > Configuration.
  2. Search for compact.
  3. Check that Turn on Compactor Initiator Thread (hive.compactor.initiator.on), Number of Threads Used by Compactor (hive.compactor.worker.threads), and Run Compactor on Hive Metastore or HiveServer2 (hive.metastore.runworker.in) are set to the values shown above.
  4. Save the changes.
  5. In Cloudera Manager, select the Hive metastore service: Clusters > HIVE_ON_TEZ-1 > Configuration.
  6. Search for compact.
  7. Check that the Number of Threads Used by Compactor (hive.compactor.worker.threads), and Run compactor on Hive Metastore or HiveServer2 (hive.metastore.runworker.in) is set to hs2.
  8. Save the changes and restart the Hive on Tez and Hive (HIVE-1) metastore services at an appropriate time.