日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

2.4-2.5、Hive整合(整合Spark、整合Hbase)、连接方式Cli、HiveServer和hivemetastore、Squirrel SQL Client等

發布時間:2024/9/27 数据库 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 2.4-2.5、Hive整合(整合Spark、整合Hbase)、连接方式Cli、HiveServer和hivemetastore、Squirrel SQL Client等 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2.4其它整合

2.4.1Hive整合Spark

Spark整合hive,需要將hive_home下的conf下的hive_site.xml放到spark_home下的conf目錄下。(3臺服務器都做相同的配置) [root@bigdata2 spark-2.3.0-bin-hadoop2.7]# cd $HIVE_HOME/conf [root@bigdata2 conf]# cp hive-site.xml $SPARK_HOME/conf

如果想使用./spark-sql 以yarn的方式運行,需要將mysql-connector-java-5.1.38.jar 放到$SPARK_HOME/jars下面

2.4.2 Hive整合HBASE

(1)修改hive-site.xml文件,添加配置屬性(zookeeper的地址)

<property><name>hbase.zookeeper.quorum</name> <value>bigdata2:2181,bigdata3:2181,bigdata4:2181,bigdata5:2181,bigdata6:2181</value> </property>

(2)引入hbase的依賴包
將hbase安裝包目錄下的lib文件夾下的包導入到hive的環境變量中
在hive-env.sh文件中添加:

export HIVE_CLASSPATH=$HIVE_CLASSPATH:$HBASE_HOME/lib

將上面的配置同步到另外2臺機器中

2.5連接方式

2.5.1Cli連接

2.5.2HiveServer2/beeline
關于beeline的更多使用,可以參考:https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients (里面介紹了更加詳細的hiveserver2/beeline的配置)

現在使用的最新的hive版本是hive-2.3.5,都需要對hadoop集群做如下改變,否則無法使用。

2.5.2.1修改hadoop集群的core-site.xml中的如下配置

<property><name>hadoop.proxyuser.root.hosts</name><!-- <value>master</value> --><value>*</value> </property><property><name>hadoop.proxyuser.root.groups</name><!-- <value>hadoop</value> --><value>*</value> </property>

即:

配置解析:
1、hadoop.proxyuser.root.hosts配置成*的意義,表示任意節點使用hadoop集群的代理用戶root都能訪問到hdfs集群。
2、hadoop.proxyuser.hadoop.groups表示代理用戶的組所屬.
3、hadoop.proxyuser.root.hosts 中的root為hadoop用戶,即hadoop的安裝目錄。

以上重啟一下hadoop集群后生效

2.5.2.2修改hive-site.xml的如下內容:

<property><name>dfs.webhdfs.enabled</name><value>true</value></property><property><name>hive.server2.thrift.client.user</name><value>root</value><description>Username to use against thrift client</description></property><property><name>hive.server2.thrift.client.password</name><value>123456</value><description>Password to use against thrift client</description></property><property><name>hive.server2.thrift.bind.host</name><value>hadoop1</value><description>Bind host on which to run the HiveServer2 Thrift service.</description></property><property><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><name>hive.server2.thrift.http.port</name><value>10001</value><description>Port number of HiveServer2 Thrift interface when hive.server2.transport.mode is 'http'.</description></property>

要注意的是這里的用戶名root,密碼是操作系統的登錄名和密碼。

然后執行:

nohup hive --service hiveserver2 &

或使用類似以下方式運行:

nohup hiveserver2 1>/home/hadoop/hiveserver.log 2>/home/hadoop/hiveserver.err & 或者:nohup hiveserver2 1>/dev/null 2>/dev/null & 或者:nohup hiveserver2 >/dev/null 2>&1 &

登錄beenline的方式:

beeline -u jdbc:hive2//hadoop1:10000 -n root -u :指定元數據的連接信息 -n :指定用戶名和密碼 另外還有一種方式可以去連接 先執行beeline,然后再輸入:!connect jdbc:hive2://hadoop1:10000 [root@hadoop1 apache-hive-2.3.4-bin]# bin/beeline SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/home/installed/apache-hive-2.3.4-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/installed/hadoop-2.8.5/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 2.3.4 by Apache Hive beeline> !connect jdbc:hive2://hadoop1:10000 Connecting to jdbc:hive2://hadoop1:10000 Enter username for jdbc:hive2://hadoop1:10000: Enter password for jdbc:hive2://hadoop1:10000: Connected to: Apache Hive (version 2.3.4) Driver: Hive JDBC (version 2.3.4) Transaction isolation: TRANSACTION_REPEATABLE_READ 0: jdbc:hive2://hadoop1:10000>



再如:

[root@hadoop1 apache-hive-2.3.4-bin]# beeline -u jdbc:hive2://hadoop1:10000 -n root SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/home/installed/apache-hive-2.3.4-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/installed/hadoop-2.8.5/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] Connecting to jdbc:hive2://hadoop1:10000 Connected to: Apache Hive (version 2.3.4) Driver: Hive JDBC (version 2.3.4) Transaction isolation: TRANSACTION_REPEATABLE_READ Beeline version 2.3.4 by Apache Hive 0: jdbc:hive2://hadoop1:10000>

2.5.3Hive wui

暫略

2.5.4和Squirrel SQL Client集成

https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients 此中最下方含有介紹。

2.5.5和Oracle的SQL Developer集成

可以和Oracle的SQLDevelopers集成
https://community.hortonworks.com/articles/1887/connect-oracle-sql-developer-to-hive.html

總結

以上是生活随笔為你收集整理的2.4-2.5、Hive整合(整合Spark、整合Hbase)、连接方式Cli、HiveServer和hivemetastore、Squirrel SQL Client等的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。