Configuration Item | Configuration Items Description | Example |
Cluster name | The name of the cluster, which is customizable. | EMR-7sx2aqmu |
Region | The physical data center where the cluster is deployed. Note: Once the cluster is created, the region cannot be changed, so choose carefully. | Beijing, Shanghai, Guangzhou, Nanjing, and Singapore. |
Container type | The service role is deployed by using resources provided by the container layer, supporting both TKE General and TKE Serverless clusters. | TKE |
Cluster network and subnet | Used for purchasing a db. It is necessary to ensure that the EMR cluster network is consistent with the container cluster network. | Guangzhou Zone 7. |
Security group | Configure security groups at the cluster level. | Create a security group. |
Billing mode | Billing mode for cluster deployment | Pay-as-You-go |
Product version | The components and their versions bundled with different product versions vary. | EMR-TKE1.0.0 includes Hadoop 2.8.5 and Spark 3.2.1. |
Deployment service | Optional components that can be customized and combined based on your needs. Select at least one component. | Hive-2.3.9 and Impala-3.4.1. |
COS bucket | Used for storing logs, JAR packages, and other information. | - |
Set Password | Set the webUI password. The current password is only used to initially set up the service webUI access password. | 8-16 characters, including uppercase letters, lowercase letters, numbers, and special characters. Special characters supported are !@%^*, and the password cannot start with a special character. |
<dependency><groupId>org.apache.hive</groupId><artifactId>hive-jdbc</artifactId><version>2.3.7</version></dependency><dependency><groupId>org.apache.hadoop</groupId><artifactId>hadoop-common</artifactId><version>2.8.5</version></dependency>
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target><encoding>utf-8</encoding></configuration></plugin><plugin><artifactId>maven-assembly-plugin</artifactId><configuration><descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs></configuration><executions><execution><id>make-assembly</id><phase>package</phase><goals><goal>single</goal></goals></execution></executions></plugin></plugins></build>
package org.apache.hive;import java.sql.*;/*** Created by tencent on 2023/6/20.*/public class HiveJdbcTest {private static String driverName ="org.apache.hive.jdbc.HiveDriver";public static void main(String[] args)throws SQLException {try {Class.forName(driverName);} catch (ClassNotFoundException e) {e.printStackTrace();System.exit(1);}Connection con = DriverManager.getConnection("jdbc:hive2://$hs2host:7001/test_db", "hadoop", "");Statement stmt = con.createStatement();String tableName = "test_jdbc";stmt.execute("drop table if exists " + tableName);stmt.execute("create table " + tableName +" (key int, value string)");System.out.println("Create table success!");// show tablesString sql = "show tables '" + tableName + "'";System.out.println("Running: " + sql);ResultSet res = stmt.executeQuery(sql);if (res.next()) {System.out.println(res.getString(1));}// describe tablesql = "describe " + tableName;System.out.println("Running: " + sql);res = stmt.executeQuery(sql);while (res.next()) {System.out.println(res.getString(1) + "\\t" + res.getString(2));}sql = "insert into " + tableName + " values (42,\\"hello\\"),(48,\\"world\\")";stmt.execute(sql);sql = "select * from " + tableName;System.out.println("Running: " + sql);res = stmt.executeQuery(sql);while (res.next()) {System.out.println(String.valueOf(res.getInt(1)) + "\\t"+ res.getString(2));}sql = "select count(1) from " + tableName;System.out.println("Running: " + sql);res = stmt.executeQuery(sql);while (res.next()) {System.out.println(res.getString(1));}}}
mvn package
java -classpath ${package}-jar-with-dependencies.jar org.apache.hive.HiveJdbcTest
Create table success!Running: show tables 'test_jdbc'test_jdbcRunning: describe test_jdbckey intvalue stringRunning: select * from test_jdbc42 hello48 worldRunning: select count(1) from test_jdbc2
package org.apache.hive;import java.sql.*;package org.apache.hive;import java.sql.*;/*** Created by tencent on 2023/6/20.*/public class KyuubiJdbcTest {private static String driverName ="org.apache.hive.jdbc.HiveDriver";public static void main(String[] args)throws SQLException {try {Class.forName(driverName);} catch (ClassNotFoundException e) {e.printStackTrace();System.exit(1);}Connection con = DriverManager.getConnection("jdbc:hive2://$kyuubihost:10009/test_db", "hadoop", "");Statement stmt = con.createStatement();String tableName = "test_kyuubi";stmt.execute("drop table if exists " + tableName);stmt.execute("create table " + tableName +" (key int, value string)");System.out.println("Create table success!");// show tablesString sql = "show tables '" + tableName + "'";System.out.println("Running: " + sql);ResultSet res = stmt.executeQuery(sql);if (res.next()) {System.out.println(res.getString(1));}// describe tablesql = "describe " + tableName;System.out.println("Running: " + sql);res = stmt.executeQuery(sql);while (res.next()) {System.out.println(res.getString(1) + "\\t" + res.getString(2));}sql = "insert into " + tableName + " values (42,\\"hello\\"),(48,\\"world\\")";stmt.execute(sql);sql = "select * from " + tableName;System.out.println("Running: " + sql);res = stmt.executeQuery(sql);while (res.next()) {System.out.println(String.valueOf(res.getInt(1)) + "\\t"+ res.getString(2));}sql = "select count(1) from " + tableName;System.out.println("Running: " + sql);res = stmt.executeQuery(sql);while (res.next()) {System.out.println(res.getString(1));}}}
mvn package
#### Uploading JAR and RunningThe upload process is the same as in JDBC Submission for Hive Spark. Run KyuubiJdbcTest using the following command:java -classpath ${package}-jar-with-dependencies.jar org.apache.hive.HiveJdbcTestPackage is your custom artifactId-version. The results are as follows: <<p243>Create table success!Running: show tables 'test_kyuubi'test_dbRunning: describe test_kyuubikey intvalue stringRunning: select * from test_kyuubi42 hello48 worldRunning: select count(1) from test_kyuubi
Was this page helpful?