欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Hive 远程多用户模式搭建

程序员文章站 2024-03-22 23:27:22
...
  1. 在master和worker1上实现远程多用户模式搭建,mysql安装配置及hadoop配置工作在本站其他博客可见。
  2. 服务端:
<configuration>  
<property>  
  <name>hive.metastore.warehouse.dir</name>  
  <value>/user/hive/warehouse</value>  
</property>  

<property>  
  <name>javax.jdo.option.ConnectionURL</name>  
  <value>jdbc:mysql://master:3306/hive?createDatabaseIfNotExist=true</value>  
</property>  

<property>  
  <name>javax.jdo.option.ConnectionDriverName</name>  
  <value>com.mysql.jdbc.Driver</value>  
</property>  

<property>  
  <name>javax.jdo.option.ConnectionUserName</name>  
  <value>root</value>  
</property>  

<property>  
  <name>javax.jdo.option.ConnectionPassword</name>  
  <value>123</value>  
</property>  
</configuration>  

3.在worker1上配置hive-site.xml
客户端:

<property>  
  <name>hive.metastore.warehouse.dir</name>  
  <value>/user/hive/warehouse</value>  
</property>  
<!--hive2中无需配置此项
<property>  
  <name>hive.metastore.local</name>  
  <value>false</value>  
</property>  
  -->
<property>  
  <name>hive.metastore.uris</name>  
  <value>thrift://master:9083</value>  
</property>  

4.拷贝JDBC包
将JDBC的jar包放入$HIVE_HOME/lib目录下

[hadoop@master tgz]$ cp mysql-connector-java-5.1.19-bin.jar /app/hive/apache-hive-2.1.1-bin/lib/

5.拷贝jline扩展包
将HIVE_HOME/lib目录下的jline-2.12.jar包
拷贝到HADOOP_HOME/share/hadoop/yarn/lib目录下,
并删除HADOOP_HOME/share/hadoop/yarn/lib目录下旧版本的jline包

[hadoop@master lib]$ cp jline-2.12.jar /app/hadoop/hadoop-2.7.3/share/hadoop/yarn/lib/
  1. 启动服务端
[[email protected] lib] hive --service metastore   

发现阻塞在此

[[email protected] conf]$ hive --service metastore
Starting Hive Metastore Server
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/app/hive/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/app/hadoop/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]

因为客户端正在监听它:9083端口
ss -nal |grep 9083
7.启动客户端

[[email protected] conf]$ hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/app/hive/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/app/hadoop/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]

Logging initialized using configuration in file:/app/hive/apache-hive-2.1.1-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> show databases;
OK
dblab
default
Time taken: 1.61 seconds, Fetched: 2 row(s)

至此多用户模式配置完成。