启动HiveServer2
目录
一. 开启metastore
[root@hadoop001 hadoop]# hive --service metastore &
[1] 29695
]0;hadoop@hadoop001:/home/hadoop[root@hadoop001 hadoop]# 2022-04-04 08:42:18: Starting Hive Metastore Server
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/module/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/module/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
二. 开启Hive
[root@hadoop001 conf]# hive
which: no hbase in (.:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/module/jdk1.8.0_231/bin:/opt/module/hadoop-2.7.3/bin:/opt/module/hadoop-2.7.3/sbin:/opt/module/sqoop-1.4.7.bin__hadoop-2.6.0/bin:/opt/module/apache-hive-3.1.2-bin/bin:/opt/module/spark-2.4.5-bin-hadoop2.7/bin:/opt/module/scala-2.11.12/bin:/home/hadoop/.local/bin:/home/hadoop/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/module/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/module/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Hive Session ID = 34a82aad-d774-4a46-ad63-e96721aacbaf
Logging initialized using configuration in file:/opt/module/apache-hive-3.1.2-bin/conf/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
Hive Session ID = e9ec8c9b-3626-486e-b9de-a93f5c051eaf
hive> show databases;
OK
default
gt_hive
ods
Time taken: 0.771 seconds, Fetched: 3 row(s)
hive> show tables;
OK
ods_test_stu
ods_test_stu3
Time taken: 0.065 seconds, Fetched: 2 row(s)
hive> exit;
[root@hadoop001 conf]#
三. 开启hiveserver2
root@hadoop001 hadoop]# hive --service hiveserver2 &
[2] 31541
]0;hadoop@hadoop001:/home/hadoop[root@hadoop001 hadoop]# which: no hbase in (.:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/module/jdk1.8.0_231/bin:/opt/module/hadoop-2.7.3/bin:/opt/module/hadoop-2.7.3/sbin:/opt/module/sqoop-1.4.7.bin__hadoop-2.6.0/bin:/opt/module/apache-hive-3.1.2-bin/bin:/opt/module/spark-2.4.5-bin-hadoop2.7/bin:/opt/module/scala-2.11.12/bin:/home/hadoop/.local/bin:/home/hadoop/bin)
2022-04-04 09:50:06: Starting HiveServer2
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/module/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/module/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Hive Session ID = 9c207f52-8a78-457a-b7ed-b7a7f995f2c0
Hive Session ID = 6c537ee1-f9eb-4ce2-a857-833ff5659689
Hive Session ID = 88d16abd-8401-4ccb-a5e3-d56d5b803cef
Hive Session ID = 14739c72-fea8-4d9d-9a5b-e09ee95fd81f
[K[root@hadoop001 hadoop]#
四. 检查服务
1. 检查Hive的两个Java进程
检查HiveMetaStore进程
[root@hadoop001 hadoop]# ps -ef | grep HiveMetaStore
root 29695 1 0 12:06 ? 00:01:07 /opt/module/jdk1.8.0_231/bin/java -Xmx256m -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/opt/module/hadoop-2.7.3/logs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/opt/module/hadoop-2.7.3 -Dhadoop.id.str=hadoop -Dhadoop.root.logger=INFO,console -Djava.library.path=/opt/module/hadoop-2.7.3/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Xmx512m -Dproc_metastore -Dlog4j.configurationFile=hive-log4j2.properties -Djava.util.logging.config.file=/opt/module/apache-hive-3.1.2-bin/conf/parquet-logging.properties -Dhadoop.security.logger=INFO,NullAppender org.apache.hadoop.util.RunJar /opt/module/apache-hive-3.1.2-bin/lib/hive-metastore-3.1.2.jar org.apache.hadoop.hive.metastore.HiveMetaStore
root 40417 40269 0 19:07 pts/4 00:00:00 grep --color=auto HiveMetaStore
检查HiveServer2进程
[root@hadoop001 hadoop]# ps -ef | grep hiveserver2
root 31541 1 0 13:14 ? 00:02:35 /opt/module/jdk1.8.0_231/bin/java -Xmx256m -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/opt/module/hadoop-2.7.3/logs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/opt/module/hadoop-2.7.3 -Dhadoop.id.str=hadoop -Dhadoop.root.logger=INFO,console -Djava.library.path=/opt/module/hadoop-2.7.3/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Xmx512m -Dproc_hiveserver2 -Dlog4j.configurationFile=hive-log4j2.properties -Djava.util.logging.config.file=/opt/module/apache-hive-3.1.2-bin/conf/parquet-logging.properties -Djline.terminal=jline.UnsupportedTerminal -Dhadoop.security.logger=INFO,NullAppender org.apache.hadoop.util.RunJar /opt/module/apache-hive-3.1.2-bin/lib/hive-service-3.1.2.jar org.apache.hive.service.server.HiveServer2 --hiveconf hive.aux.jars.path=file:///opt/module/apache-hive-3.1.2-bin/lib/accumulo-core-1.7.3.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/accumulo-fate-1.7.3.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/accumulo-start-1.7.3.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/accumulo-trace-1.7.3.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/aircompressor-0.10.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/ant-1.9.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/ant-launcher-1.9.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/antlr4-runtime-4.5.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/antlr-runtime-3.5.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/aopalliance-repackaged-2.5.0-b32.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/apache-jsp-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/apache-jstl-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/arrow-format-0.8.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/arrow-memory-0.8.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/arrow-vector-0.8.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/asm-5.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/asm-commons-5.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/asm-tree-5.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/audience-annotations-0.5.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/avatica-1.11.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/avro-1.7.7.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/bonecp-0.8.0.RELEASE.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/calcite-core-1.16.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/calcite-druid-1.16.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/calcite-linq4j-1.16.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-cli-1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-codec-1.7.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-collections4-4.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-compiler-2.7.6.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-compress-1.9.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-crypto-1.0.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-dbcp-1.4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-io-2.4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-lang-2.6.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-lang3-3.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-logging-1.0.4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-math-2.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-math3-3.6.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-pool-1.5.4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/commons-vfs2-2.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/curator-client-2.12.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/curator-framework-2.12.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/curator-recipes-2.12.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/datanucleus-api-jdo-4.2.4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/datanucleus-core-4.1.17.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/datanucleus-rdbms-4.1.19.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/derby-10.14.1.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/disruptor-3.3.6.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/dropwizard-metrics-hadoop-metrics2-reporter-0.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/druid-hdfs-storage-0.12.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/ecj-4.4.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/esri-geometry-api-2.0.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/findbugs-annotations-1.3.9-1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/flatbuffers-1.2.0-3f79e055.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/groovy-all-2.4.11.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/gson-2.2.4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/guava-19.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-client-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-common-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-common-2.0.0-alpha4-tests.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-hadoop2-compat-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-hadoop2-compat-2.0.0-alpha4-tests.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-hadoop-compat-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-http-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-mapreduce-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-metrics-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-metrics-api-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-prefix-tree-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-procedure-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-protocol-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-protocol-shaded-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-replication-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-server-2.0.0-alpha4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-shaded-miscellaneous-1.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-shaded-netty-1.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hbase-shaded-protobuf-1.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/HikariCP-2.6.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-accumulo-handler-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-beeline-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-classification-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-cli-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-common-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-contrib-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-druid-handler-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-exec-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-hbase-handler-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-hcatalog-core-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-hcatalog-server-extensions-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-hplsql-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-jdbc-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-jdbc-handler-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-kryo-registrator-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-llap-client-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-llap-common-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-llap-common-3.1.2-tests.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-llap-ext-client-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-llap-server-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-llap-tez-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-metastore-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-serde-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-service-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-service-rpc-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-shims-0.23-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-shims-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-shims-common-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-shims-scheduler-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-standalone-metastore-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-storage-api-2.7.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-streaming-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-testutils-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-upgrade-acid-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hive-vector-code-gen-3.1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hk2-api-2.5.0-b32.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hk2-locator-2.5.0-b32.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hk2-utils-2.5.0-b32.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/hppc-0.7.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/htrace-core-3.2.0-incubating.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/httpclient-4.5.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/httpcore-4.4.4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/ivy-2.4.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jackson-annotations-2.9.5.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jackson-core-2.9.5.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jackson-core-asl-1.9.13.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jackson-databind-2.9.5.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jackson-dataformat-smile-2.9.5.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jackson-mapper-asl-1.9.13.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jamon-runtime-2.3.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/janino-2.7.6.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/javassist-3.20.0-GA.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/javax.annotation-api-1.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/javax.inject-2.5.0-b32.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/javax.jdo-3.2.0-m3.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/javax.servlet-api-3.1.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/javax.servlet.jsp-2.3.2.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/javax.servlet.jsp-api-2.3.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/javax.ws.rs-api-2.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/javolution-5.5.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jaxb-api-2.2.11.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jcodings-1.0.18.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jcommander-1.32.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jdo-api-3.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jersey-client-2.25.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jersey-common-2.25.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jersey-container-servlet-core-2.25.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jersey-guava-2.25.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jersey-media-jaxb-2.25.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jersey-server-2.25.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jettison-1.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-annotations-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-client-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-http-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-io-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-jaas-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-jndi-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-plus-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-rewrite-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-runner-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-schemas-3.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-security-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-server-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-servlet-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-util-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-webapp-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jetty-xml-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jline-2.12.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/joda-time-2.9.9.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/joni-2.1.11.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jpam-1.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/json-1.8.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jsr305-3.0.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/jta-1.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/libfb303-0.9.3.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/libthrift-0.9.3.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/log4j-1.2-api-2.10.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/log4j-api-2.10.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/log4j-core-2.10.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/log4j-web-2.10.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/memory-0.9.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/metrics-core-3.1.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/metrics-json-3.1.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/metrics-jvm-3.1.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/mysql-connector-java-5.1.38.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/mysql-metadata-storage-0.12.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/netty-3.10.5.Final.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/netty-all-4.1.17.Final.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/netty-buffer-4.1.17.Final.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/netty-common-4.1.17.Final.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/opencsv-2.3.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/orc-core-1.5.6.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/orc-shims-1.5.6.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/org.abego.treelayout.core-1.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/osgi-resource-locator-1.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/paranamer-2.3.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/parquet-hadoop-bundle-1.10.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/postgresql-9.4.1208.jre7.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/postgresql-metadata-storage-0.12.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/protobuf-java-2.5.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/sketches-core-0.9.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/snappy-java-1.1.4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/sqlline-1.3.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/ST4-4.0.4.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/stax-api-1.0.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/super-csv-2.2.0.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/taglibs-standard-impl-1.2.5.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/taglibs-standard-spec-1.2.5.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/tempus-fugit-1.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/transaction-api-1.1.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/validation-api-1.1.0.Final.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/velocity-1.5.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/websocket-api-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/websocket-client-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/websocket-common-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/websocket-server-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/websocket-servlet-9.3.20.v20170531.jar,file:///opt/module/apache-hive-3.1.2-bin/lib/zookeeper-3.4.6.jar
root 40419 40269 0 19:07 pts/4 00:00:00 grep --color=auto hiveserver2
[root@hadoop001 hadoop]#
2. 检查HiveServer2的thrift端口是否启动
- 查看HiveServer2的thrift主机配置
[root@hadoop001 conf]# grep 'hive.server2.thrift.bind.host' hive-site.xml -A 4
<name>hive.server2.thrift.bind.host</name>
<value>192.168.5.101</value>
<description>Bind host on which to run the HiveServer2 Thrift service.</description>
</property>
<property>
--
<description>The server address of HiverServer2 host to be used for communication between Hive client and remote Spark driver. Default is empty, which means the address will be determined in the same way as for hive.server2.thrift.bind.host.This is only necessary if the host has multiple network addresses and if a different network address other than hive.server2.thrift.bind.host is to be used.</description>
</property>
<property>
<name>hive.spark.client.rpc.server.port</name>
<value/>
- 查看HiveServer2的thrift端口配置
[root@hadoop001 conf]# grep 'hive.server2.thrift.port' hive-site.xml -A 4
<name>hive.server2.thrift.port</name>
<value>10000</value>
<description>Port number of HiveServer2 Thrift interface when hive.server2.transport.mode is 'binary'.</description>
</property>
<property>
[root@hadoop001 conf]#
- 查看thrift端口是否启动
[root@hadoop001 conf]# netstat -tunpl | grep 10000
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 31541/java
五. Beeline连接
[root@hadoop001 conf]# beeline
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/module/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/module/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Beeline version 3.1.2 by Apache Hive
beeline> !connect jdbc:hive2://192.168.5.101:10000
Connecting to jdbc:hive2://192.168.5.101:10000
Enter username for jdbc:hive2://192.168.5.101:10000: root
Enter password for jdbc:hive2://192.168.5.101:10000: ********
Connected to: Apache Hive (version 3.1.2)
Driver: Hive JDBC (version 3.1.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://192.168.5.101:10000> show databases;
INFO : Compiling command(queryId=root_20220404192448_b9fa5705-f244-4709-ac79-ed1b39854a0e): show databases
INFO : Concurrency mode is disabled, not creating a lock manager
INFO : Semantic Analysis Completed (retrial = false)
INFO : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO : Completed compiling command(queryId=root_20220404192448_b9fa5705-f244-4709-ac79-ed1b39854a0e); Time taken: 0.125 seconds
INFO : Concurrency mode is disabled, not creating a lock manager
INFO : Executing command(queryId=root_20220404192448_b9fa5705-f244-4709-ac79-ed1b39854a0e): show databases
INFO : Starting task [Stage-0:DDL] in serial mode
INFO : Completed executing command(queryId=root_20220404192448_b9fa5705-f244-4709-ac79-ed1b39854a0e); Time taken: 0.055 seconds
INFO : OK
INFO : Concurrency mode is disabled, not creating a lock manager
+----------------+
| database_name |
+----------------+
| default |
| gt_hive |
| ods |
+----------------+
3 rows selected (0.514 seconds)
0: jdbc:hive2://192.168.5.101:10000> !quit
Closing: 0: jdbc:hive2://192.168.5.101:10000
[root@hadoop001 conf]#
六. 查看HiveServer2的Web页面
七. Dbeaver客户端连接
连接设置
说明:HiveMetaStore是存储在MySQL数据库中
八. HiveMetaStore相关配置
[root@hadoop001 conf]# grep 'hive.metastore.uris' hive-site.xml -A 3
<name>hive.metastore.uris</name>
<value>thrift://hadoop001:9083</value>
<description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
</property>
[root@hadoop001 conf]# grep 'option.ConnectionURL' hive-site.xml -A 3
<description>Name of the hook to use for retrieving the JDO connection URL. If empty, the value in javax.jdo.option.ConnectionURL is used</description>
</property>
<property>
<name>javax.jdo.option.Multithreaded</name>
--
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.5.102:3306/hivemeta?createDatabaseIfNotExist=true&useSSL=false</value>
<description>
JDBC connect string for a JDBC metastore.
[root@hadoop001 conf]#
[root@hadoop001 conf]# grep 'option.ConnectionDriverName' hive-site.xml -A 3
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
[root@hadoop001 conf]# grep 'option.ConnectionUserName' hive-site.xml -A 3
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
<description>Username to use against metastore database</description>
</property>
[root@hadoop001 conf]# grep 'option.ConnectionPassword' hive-site.xml -A 3
<name>javax.jdo.option.ConnectionPassword</name>
<value>root1234</value>
<description>password to use against metastore database</description>
</property>
--
<value>javax.jdo.option.ConnectionPassword,hive.server2.keystore.password,fs.s3.awsAccessKeyId,fs.s3.awsSecretAccessKey,fs.s3n.awsAccessKeyId,fs.s3n.awsSecretAccessKey,fs.s3a.access.key,fs.s3a.secret.key,fs.s3a.proxy.password,dfs.adls.oauth2.credential,fs.adl.oauth2.credential</value>
<description>Comma separated list of configuration options which should not be read by normal user like passwords</description>
</property>
<property>
[root@hadoop001 conf]# grep 'metastore.warehouse.dir' hive-site.xml -A 3
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
[root@hadoop001 conf]# grep 'exec.scratchdir' hive-site.xml -A 3
<description>Directory name that will be created inside table locations in order to support HDFS encryption. This is replaces ${hive.exec.scratchdir} for query results with the exception of read-only tables. In all cases ${hive.exec.scratchdir} is still used for other temporary files, such as job plans.</description>
</property>
<property>
<name>hive.exec.scratchdir</name>
<value>/tmp/hive</value>
<description>HDFS root scratch dir for Hive jobs which gets created with write all (733) permission. For each connecting user, an HDFS scratch dir: ${hive.exec.scratchdir}/<username> is created, with ${hive.scratch.dir.permission}.</description>
</property>
<property>
<name>hive.repl.rootdir</name>