This document introduces the configuration and use of LDAP in Hive on EMR.
Development Preparation
Make sure you have activated Tencent Cloud and created an EMR cluster. For more details, see Creating a Cluster. Create a Hadoop default scene cluster and select the Hive component in the software configuration interface.
Enabling LDAP Authentication
Enter the EMR console, click Cluster Services > HIVE > Configuration Management, select the hive-site.xml configuration file, add the following configuration items, set parameter values, save the configuration and deploy it, and then restart HiveServer2:
|
hive.server2.authentication | LDAP | Set the authentication mechanism to LDAP. |
hive.server2.authentication.ldap.url | ldap://$l{dap_ip}:389 | Specify the URL for the LDAP service. ${ldap_ip} represents the IP address of the OPENLDAP service node, which can be found under Cluster Services > OPENLDAP in the EMR console. For a self-built LDAP service, fill in the details according to your actual setup. |
hive.server2.authentication.ldap.baseDN | ou=People,dc=emr,dc=cloud,dc=tencent,dc=com | The Base DN where the LDAP service user is located in EMR. For a self-built LDAP service, fill in the details according to your actual setup. |
hive.server2.authentication.ldap.guidKey | cn | The LDAP service username format in EMR. For a self-built LDAP service, fill in the details according to your actual setup. |
Accessing HiveServer2
After enabling LDAP authentication, you will need to provide the LDAP username and password to access HiveServer2.
Connecting to Hive with Beeline Client
beeline -u "jdbc:hive2://${hs2_ip}:${hs2_port}" -n ${user} -p ${password}
Connecting to Hive with JDBC
jdbc:hive2://${hs2_ip}:${hs2_port}/default;user=${user};password=${password}
Note:
1. ${user} represents the LDAP username.
2. ${password} represents the LDAP password.
3. ${hs2_ip} is the private IP address of the node where the HiveServer2 service is deployed. You can view it on the cluster details page under Cluster Services > Hive > Role Management.
4. ${hs2_port} is the port number of the HiveServer2 in the cluster, with a default value of 7001. You can view it on the cluster details page under Cluster Services > Hive > Configuration Management by checking the hive.server2.thrift.port setting in the hive-site.xml configuration file.
Note:
After integrating Hive with EMR OpenLDAP and adding a new user, grant 644 permissions to the /emr/hive directory under HDFS for the new user to access.
Was this page helpful?