The cold access collection feature for JindoTable tables or partitions records the last access time of each table or partition. This helps you identify data that has not been accessed recently, optimize your data storage strategy, and reduce costs. For example, in data analytics, you can move infrequently used partition data to a lower-cost storage medium to save money.
Prerequisites
Create an EMR cluster of version 3.35.0 or later, or version 4.9.0 or later. For more information, see Create a cluster.
Background information
Limits
- DLF data lake metadata is not supported.
- The IP addresses of Hive CLI, HiveServer2, Spark SQL CLI, Spark Thriftserver, and Presto services must have permission to access the underlying metadata storage (MySQL or RDS).
- Cold access collection is supported only for Hive, Spark, and Presto components.
Query data
- Syntax
jindo table -leastUseStat -n <num> [-i/-ignoreNever]num is the number of entries to display and must be a positive integer. -i/-ignoreNever is optional. If specified, tables or partitions that have never been accessed are excluded from the results.
- Function
Displays the tables or partitions that have not been accessed for the longest time.
- Example: Query the 20 least recently accessed tables or partitions.
jindo table -leastUseStat -n 20Returns three columns as shown in the following figure.
- The first column shows the table name in the format database_name.table_name.
- The second column shows the partition name in the format partition_key_column1=value1/partition_key_column2=value2/.... This field is empty for non-partitioned tables.
- The third column shows the most recent access time in the format yyyy-MM-dd HH:mm:ss.
Note For partitioned tables, only partitions are displayed. The table itself is not listed separately.
For more information about using JindoTable, see JindoTable usage instructions.
Enable cold access collection for Spark
- Go to the Spark page.
- Log on to the Alibaba Cloud E-MapReduce console.
- In the top menu bar, select a region and resource group as needed.
- Click the Clusters tab.
- On the Clusters page, click Details in the row of the target cluster.
- In the navigation pane on the left, choose .
- Log on to the Alibaba Cloud E-MapReduce console.
- On the Spark service page, click the Configure tab.
- Search for the parameter spark.sql.queryExecutionListeners. Ensure its value includes com.aliyun.emr.table.spark.SparkSQLQueryListener. Separate multiple listeners with commas (,).

- Add a custom configuration.
- On the Service Configuration page, click the spark-defaults tab.
- Click Custom Configuration in the upper-right corner.
- In the Add Configuration Item dialog box, set Key to spark.sql.query.update.access.time.enabled and Value to true.

- Click OK.
- Save the configuration.
- Click Save.
- In the Confirm dialog box, enter an Execution Reason and click OK.
- Restart all components.
- In the upper-right corner, choose .
- In the Execute Cluster Operation dialog box, enter an Execution Reason and click OK.
- In the Confirm dialog box, click OK.
Enable cold access collection for Hive
- Go to the Hive page.
- Log on to the Alibaba Cloud E-MapReduce console.
- In the top menu bar, select a region and resource group as needed.
- Click the Clusters tab.
- On the Clusters page, click Details in the row of the target cluster.
- In the navigation pane on the left, choose .
- Log on to the Alibaba Cloud E-MapReduce console.
- On the Hive service page, click the Configure tab.
- Search for the parameter hive.exec.post.hooks. Ensure its value includes com.aliyun.emr.table.hive.HivePostHook. Separate multiple hooks with commas (,).

- Add a custom configuration.
- On the Service Configuration page, click the hive-site tab.
- Click Custom Configuration in the upper-right corner.
- In the Add Configuration Item dialog box, set Key to hive.hook.update.access.time.enabled and Value to true.

- Click OK.
- Save the configuration.
- Click Save.
- In the Confirm dialog box, enter an Execution Reason and click OK.
- Restart all components.
- In the upper-right corner, choose .
- In the Execute Cluster Operation dialog box, enter an Execution Reason and click OK.
- In the Confirm dialog box, click OK.
Enable cold access collection for Presto
- Go to the Presto page.
- Log on to the Alibaba Cloud E-MapReduce console.
- In the top menu bar, select a region and resource group as needed.
- Click the Clusters tab.
- On the Clusters page, click Details in the row of the target cluster.
- In the navigation pane on the left, choose .
- Log on to the Alibaba Cloud E-MapReduce console.
- On the Presto service page, click the Configure tab.
- Search for the parameter event-listener.name. Ensure its value includes jindo-presto-post-event-listener.

- Add a custom configuration.
- On the Service Configuration page, click the event-listener.properties tab.
- Click Custom Configuration in the upper-right corner.
- In the Add Configuration Item dialog box, set Key to listener.update.access.time.enabled and Value to true.

- Click OK.
- Save the configuration.
- Click Save.
- In the Confirm dialog box, enter an Execution Reason and click OK.
- Restart all components.
- In the upper-right corner, choose .
- In the Execute Cluster Operation dialog box, enter an Execution Reason and click OK.
- In the Confirm dialog box, click OK.