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/tablespace
to/warehouse/tablespace-old
. -
Create an encryption zone at
/warehouse/tablespace
. -
distcp
all of the data from/warehouse/tablespace-old
to/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/tmp
are 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.db
and/warehouse/tablespace/managed/ez2.db
. - Load data into Hive tables
ez1.db
andez2.db
as usual, usingLOAD
statements.