Hive Access Configuration on Windows Using EIPs
Scenario
This section describes how to bind Elastic IP addresses (EIPs) to a cluster and configure Hive files so that sample files can be compiled locally.
This section uses hive-jdbc-example as an example.
Procedure
- Apply for an EIP for each node in the cluster and add public IP addresses and corresponding host domain names of all nodes to the Windows local hosts file. (If a host name contains uppercase letters, change them to lowercase letters.)
- On the VPC console, apply for EIPs (the number of EIPs you buy should be equal to the number of nodes in the cluster), click the name of each node in the MRS cluster, and bind an EIP to each node on the EIPs page.
For details, see
. - Record the mapping between the public IP addresses and private IP addresses. Change the private IP addresses in the hosts file to the corresponding public IP addresses.
- On the VPC console, apply for EIPs (the number of EIPs you buy should be equal to the number of nodes in the cluster), click the name of each node in the MRS cluster, and bind an EIP to each node on the EIPs page.
- Change the IP addresses in the krb5.conf file to the corresponding host names.
- Configure security group rules for the cluster.
- On the Dashboard page, choose Add Security Group Rule > Manage Security Group Rule.
- On the Inbound Rules tab page, click Add Rule. In the Add Inbound Rule dialog box, configure Windows IP addresses and ports 21730TCP, 21731TCP/UDP, and 21732TCP/UDP.
- On the Dashboard page, choose Add Security Group Rule > Manage Security Group Rule.
- On Manager, choose Cluster > Services > Hive > More > Download Client, and copy the core-site.xml and hiveclient.properties files on the client to the resources directory of the sample project.
- In the sample code, change the ZooKeeper IP addresses in the JDBC URL to the HiveServer2 host name for connection. Change the URL to jdbc:hive2:// HiveServer host name:10000/.
- The IP addresses in the /hiveserver2 directory of ZooKeeper are private IP addresses and cannot be used to connect to Hive from Windows. Therefore, you need to replace ZooKeeper IP addresses with the HiveServer2 host name.
- To obtain the HiveServer2 host name, choose Cluster > Services > Hive > Instance on Manager and view Host Name of HiveServer on the Instance page.
- Before running the sample code, change PRNCIPAL_NAME in the sample code to the username for security authentication.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.