You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/hdinsight/domain-joined/apache-domain-joined-run-hive.md
+68-47Lines changed: 68 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,28 @@
1
1
---
2
2
title: Apache Hive policies in Apache Ranger - Azure HDInsight
3
3
description: Learn how to configure Apache Ranger policies for Hive in an Azure HDInsight service with Enterprise Security Package.
4
-
ms.service: hdinsight
5
4
author: omidm1
6
5
ms.author: omidm
7
6
ms.reviewer: jasonh
8
-
ms.custom: hdinsightactive
7
+
ms.service: hdinsight
9
8
ms.topic: conceptual
10
-
ms.date: 09/24/2018
9
+
ms.custom: hdinsightactive
10
+
ms.date: 11/27/2019
11
11
---
12
12
13
13
# Configure Apache Hive policies in HDInsight with Enterprise Security Package
14
-
Learn how to configure Apache Ranger policies for Apache Hive. In this article, you create two Ranger policies to restrict access to the hivesampletable. The hivesampletable comes with HDInsight clusters. After you have configured the policies, you use Excel and ODBC driver to connect to Hive tables in HDInsight.
14
+
15
+
Learn how to configure Apache Ranger policies for Apache Hive. In this article, you create two Ranger policies to restrict access to the hivesampletable. The hivesampletable comes with HDInsight clusters. After you've configured the policies, you use Excel and ODBC driver to connect to Hive tables in HDInsight.
15
16
16
17
## Prerequisites
18
+
17
19
* A HDInsight cluster with Enterprise Security Package. See [Configure HDInsight clusters with ESP](apache-domain-joined-configure.md).
18
20
* A workstation with Office 2016, Office 2013 Professional Plus, Office 365 Pro Plus, Excel 2013 Standalone, or Office 2010 Professional Plus.
19
21
20
22
## Connect to Apache Ranger Admin UI
21
23
**To connect to Ranger Admin UI**
22
24
23
-
1. From a browser, connect to Ranger Admin UI. The URL is https://<ClusterName>.azurehdinsight.net/Ranger/.
25
+
1. From a browser, navigate to the Ranger Admin UI at `https://CLUSTERNAME.azurehdinsight.net/Ranger/` where CLUSTERNAME is the name of your cluster.
24
26
25
27
> [!NOTE]
26
28
> Ranger uses different credentials than Apache Hadoop cluster. To prevent browsers using cached Hadoop credentials, use new InPrivate browser window to connect to the Ranger Admin UI.
@@ -32,87 +34,105 @@ Learn how to configure Apache Ranger policies for Apache Hive. In this article,
32
34
Currently, Ranger only works with Yarn and Hive.
33
35
34
36
## Create Domain users
37
+
35
38
See [Create a HDInsight cluster with ESP](apache-domain-joined-configure-using-azure-adds.md#create-a-hdinsight-cluster-with-esp), for information on how to create hiveruser1 and hiveuser2. You use the two user accounts in this article.
36
39
37
40
## Create Ranger policies
38
-
In this section, you create two Ranger policies for accessing hivesampletable. You give select permission on different set of columns. Both users were created using [Create a HDInsight cluster with ESP](apache-domain-joined-configure-using-azure-adds.md#create-a-hdinsight-cluster-with-esp). In the next section, you will test the two policies in Excel.
41
+
42
+
In this section, you create two Ranger policies for accessing hivesampletable. You give select permission on different set of columns. Both users were created using [Create a HDInsight cluster with ESP](apache-domain-joined-configure-using-azure-adds.md#create-a-hdinsight-cluster-with-esp). In the next section, you'll test the two policies in Excel.
39
43
40
44
**To create Ranger policies**
41
45
42
46
1. Open Ranger Admin UI. See Connect to Apache Ranger Admin UI.
43
-
2. Click **<ClusterName>_hive**, under **Hive**. You shall see two pre-configure policies.
44
-
3. Click **Add New Policy**, and then enter the following values:
> If a domain user is not populated in Select User, wait a few moments for Ranger to sync with AAD.
63
+
64
+
4. Select **Add** to save the policy.
65
+
60
66
5. Repeat the last two steps to create another policy with the following properties:
61
67
62
-
* Policy name: read-hivesampletable-devicemake
63
-
* Hive Database: default
64
-
* table: hivesampletable
65
-
* Hive column: clientid, devicemake
66
-
* Select User: hiveuser2
67
-
* Permissions: select
68
+
|Property |Value |
69
+
|---|---|
70
+
|Policy Name|read-hivesampletable-devicemake|
71
+
|Hive Database|default|
72
+
|table|hivesampletable|
73
+
|Hive column|clientid, devicemake|
74
+
|Select User|hiveuser2|
75
+
|Permissions|select|
68
76
69
77
## Create Hive ODBC data source
78
+
70
79
The instructions can be found in [Create Hive ODBC data source](../hadoop/apache-hadoop-connect-excel-hive-odbc-driver.md).
71
80
72
81
| Property |Description |
73
82
| --- | --- |
74
83
| Data Source Name | Give a name to your data source |
75
-
| Host | Enter <HDInsightClusterName>.azurehdinsight.net. For example, myHDICluster.azurehdinsight.net |
84
+
| Host | Enter CLUSTERNAME.azurehdinsight.net. For example, myHDICluster.azurehdinsight.net |
76
85
| Port | Use **443**. (This port has been changed from 563 to 443.) |
77
86
| Database | Use **Default**. |
78
87
| Hive Server Type | Select **Hive Server 2**|
79
88
| Mechanism | Select **Azure HDInsight Service**|
80
89
| HTTP Path | Leave it blank. |
81
-
| User Name | Enter [email protected]. Update the domain name if it is different. |
90
+
| User Name | Enter [email protected]. Update the domain name if it's different. |
82
91
| Password | Enter the password for hiveuser1. |
83
92
84
93
Make sure to click **Test** before saving the data source.
85
94
86
95
## Import data into Excel from HDInsight
87
-
In the last section, you have configured two policies. hiveuser1 has the select permission on all the columns, and hiveuser2 has the select permission on two columns. In this section, you impersonate the two users to import data into Excel.
96
+
97
+
In the last section, you've configured two policies. hiveuser1 has the select permission on all the columns, and hiveuser2 has the select permission on two columns. In this section, you impersonate the two users to import data into Excel.
88
98
89
99
1. Open a new or existing workbook in Excel.
90
-
2. From the **Data** tab, click **From Other Data Sources**, and then click **From Data Connection Wizard** to launch the **Data Connection Wizard**.
91
100
92
-
![Open data connection wizard][img-hdi-simbahiveodbc.excel.dataconnection]
93
-
3. Select **ODBC DSN** as the data source, and then click **Next**.
94
-
4. From ODBC data sources, select the data source name that you created in the previous step, and then click **Next**.
95
-
5. Reenter the password for the cluster in the wizard, and then click **OK**. Wait for the **Select Database and Table** dialog to open. This can take a few seconds.
96
-
6. Select **hivesampletable**, and then click **Next**.
97
-
7. Click **Finish**.
98
-
8. In the **Import Data** dialog, you can change or specify the query. To do so, click **Properties**. This can take a few seconds.
99
-
9. Click the **Definition** tab. The command text is:
101
+
1. From the **Data** tab, navigate to **Get Data** > **From Other Sources** > **From ODBC** to launch the **From ODBC** window.
102
+
103
+

104
+
105
+
1. From the drop-down list, select the data source name that you created in the last section and then select **OK**.
106
+
107
+
1. For the first use, an **ODBC driver** dialog will open. Select **Windows** from the left menu. Then select **Connect** to open the **Navigator** window.
108
+
109
+
1. Wait for the **Select Database and Table** dialog to open. This can take a few seconds.
110
+
111
+
1. Select **hivesampletable**, and then select **Next**.
112
+
113
+
1. Select **Finish**.
114
+
115
+
1. In the **Import Data** dialog, you can change or specify the query. To do so, select **Properties**. This can take a few seconds.
116
+
117
+
1. Select the **Definition** tab. The command text is:
100
118
101
119
SELECT * FROM "HIVE"."default"."hivesampletable"
102
120
103
-
By the Ranger policies you defined, hiveuser1 has select permission on all the columns. So this query works with hiveuser1's credentials, but this query does not work with hiveuser2's credentials.
121
+
By the Ranger policies you defined, hiveuser1 has select permission on all the columns. So this query works with hiveuser1's credentials, but this query doesn't work with hiveuser2's credentials.
10. Click **OK** to close the Connection Properties dialog.
107
-
11. Click **OK** to close the **Import Data** dialog.
108
-
12. Reenter the password for hiveuser1, and then click **OK**. It takes a few seconds before data gets imported to Excel. When it is done, you shall see 11 columns of data.
123
+
1. Select **OK** to close the Connection Properties dialog.
124
+
125
+
1. Select **OK** to close the **Import Data** dialog.
126
+
127
+
1. Reenter the password for hiveuser1, and then click **OK**. It takes a few seconds before data gets imported to Excel. When it's done, you shall see 11 columns of data.
109
128
110
129
To test the second policy (read-hivesampletable-devicemake), you created in the last section
111
130
112
131
1. Add a new sheet in Excel.
113
132
2. Follow the last procedure to import the data. The only change you make is to use hiveuser2's credentials instead of hiveuser1's. This fails because hiveuser2 only has permission to see two columns. You shall get the following error:
114
133
115
134
[Microsoft][HiveODBC] (35) Error from Hive: error code: '40000' error message: 'Error while compiling statement: FAILED: HiveAccessControlException Permission denied: user [hiveuser2] does not have [SELECT] privilege on [default/hivesampletable/clientid,country ...]'.
135
+
116
136
3. Follow the same procedure to import data. This time, use hiveuser2's credentials, and also modify the select statement from:
117
137
118
138
SELECT * FROM "HIVE"."default"."hivesampletable"
@@ -121,9 +141,10 @@ To test the second policy (read-hivesampletable-devicemake), you created in the
121
141
122
142
SELECT clientid, devicemake FROM "HIVE"."default"."hivesampletable"
123
143
124
-
When it is done, you shall see two columns of data imported.
144
+
When it's done, you shall see two columns of data imported.
125
145
126
146
## Next steps
147
+
127
148
* For configuring a HDInsight cluster with Enterprise Security Package, see [Configure HDInsight clusters with ESP](apache-domain-joined-configure.md).
128
149
* For managing a HDInsight cluster with ESP, see [Manage HDInsight clusters with ESP](apache-domain-joined-manage.md).
129
150
* For running Hive queries using SSH on HDInsight clusters with ESP, see [Use SSH with HDInsight](../hdinsight-hadoop-linux-use-ssh-unix.md#domainjoined).
0 commit comments