Configure Hive Tables for HDFS Encryption
Before enabling encryption zones, decide whether to store your Hive tables across one zone or multiple encryption zones.
For a Single Encryption Zone
-
To configure a single encryption zone for your entire Hive warehouse:
-
Rename
/warehouse/tablespaceto/warehouse/tablespace-old. -
Create an encryption zone at
/warehouse/tablespace. -
distcpall of the data from/warehouse/tablespace-oldto/warehouse/tablespace.
-
Rename
-
To configure the Hive scratch directory (
hive.exec.scratchdir) so that it resides inside the encryption zone:-
Set the directory to
/warehouse/tablespace/tmp. -
Make sure that the permissions for
/warehouse/tablespace/tmpare set to1777.
-
Set the directory to
For multiple Encryption Zones
To access encrypted databases and tables with different encryption keys, configure multiple encryption zones.
For example, to configure two encrypted tables, ez1.db and
ez2.db, in two different encryption zones:
- Create two new encryption zones,
/warehouse/tablespace/managed/ez1.dband/warehouse/tablespace/managed/ez2.db. - Load data into Hive tables
ez1.dbandez2.dbas usual, usingLOADstatements.

