【Hadoop】hiveserver2 不能啟動端口 10000 開啟服務的相關經驗總結


 

轉載來自http://blog.csdn.net/lsttoy/article/details/53490144。 

 

這個問題困擾了我三天,各種查資料踩坑填坑的嘗試,終於搞定了這個問題。

首先來品嘗下喜悅!

[root@master bin]# beeline ls: cannot access /home/hive/lib/hive-jdbc-*-standalone.jar: No such file or directory Beeline version 2.1.0 by Apache Hive beeline> !connect jdbc:hive2://114.215.xxx.xxx:10000/default Connecting to jdbc:hive2://114.215.xxx.xxx:10000/default Enter username for jdbc:hive2://114.215.xxx.xxx:10000/default: root Enter password for jdbc:hive2://114.215.xxx.xxx:10000/default: ************ SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/home/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/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] Connected to: Apache Hive (version 2.1.0) Driver: Hive JDBC (version 2.1.0) 16/12/06 17:08:41 [main]: WARN jdbc.HiveConnection: Request to set autoCommit to false; Hive does not support autoCommit=false. Transaction isolation: TRANSACTION_REPEATABLE_READ 0: jdbc:hive2://114.215.xxx.xxx:10000/default> 

OK,言歸正傳。從頭梳理面臨了多少問題。 
如果還沒有安裝hive的同學可以參見我之前的博文教程。

《【Hadoop】hadoop2.7.3安裝hive 2.1.0》


第一個問題 
報錯內容如下:

org.apache.hadoop.ipc.RemoteException: User: root is not allowed to impersonate root

這點就比較惡心了,一般來說,可能只是在hadoop中配置的代理用戶不一樣,如hadoop is not allowed to impersonate root 或者 root is not allowed to impersonate hive 啥的,但是根據網絡上調整后嘗試的方法,即對應value上面調整為hadoop 和localhost,沒有作用。 
我本人的設置為: 
這里第三個字段我是root,因為試驗環境,我全部用的root,避免權限問題。你可以根據自己的來設置。

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

第二個問題 
報錯內容如下:

beeline> !connect jdbc:hive2://114.215.xxx.xxx:10000/default Connecting to jdbc:hive2://114.215.xxx.xxx:10000/default Enter username for jdbc:hive2://114.215.xxx.xxx:10000/default: root Enter password for jdbc:hive2://114.215.xxx.xxx:10000/default: ************ 16/12/05 14:25:23 [main]: WARN jdbc.HiveConnection: Failed to connect to 114.215.xxx.xxx:10000 Error: Could not open client transport with JDBC Uri: jdbc:hive2://114.215.xxx.xxx:10000/default: java.net.ConnectException: Connection refused (state=08S01,code=0)

這里鏈接拒絕,說明以下幾個問題 
第一個,至少你連接是成功的,不然不會出現讓你驗證username和password的問題。 
第二個,你的鏈接有問題。有可能是你現在連接的並不是hive2,而是啟動的服務hiveserver。這個和hiveserver2有很大的版本區別,具體可以百度。 
第三個,當鏈接的是hive2,但是還是拒絕的時候,可能問題出在你配置上面,如下:

  <property> <name>hive.server2.transport.mode</name> <value>binary</value> <description> Expects one of [binary, http]. Transport mode of HiveServer2. </description> </property>

切記,當你這里設置為http的時候,此時服務器只提供端口10001的服務,即HTTP方式訪問。 
這時候10000端口是不開啟的! 
本人就是在這個地方卡了好幾天。因此你要用java通過jdbc訪問,一定要選擇binary。

第三個問題 
報錯內容如下:

[root@master ~]# Starting Hive Metastore Server SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/home/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/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] org.apache.thrift.transport.TTransportException: Could not create ServerSocket on address 0.0.0.0/0.0.0.0:9083.

這里表示你可能存在兩個問題: 
其一,9083端口的metastore服務已經在使用中,你要停止,可以通過查詢PID然后kill來進行重新啟動。(如果你選擇的是后台啟動的話hive –service metastore &) 
其二,你的設置文件中hive-site.xml中,注意metastore的設置。 
我這里給出我一部分的設置,其他的你可以百度自己查詢。

 <property>
    <name>hive.metastore.local</name> <value>false</value> <description>controls whether to connect to remote metastore server or open a new metastore server in Hive Client JVM</description> </property> <property> <name>hive.metastore.uris</name> <value>thrift://114.215.xxx.xxx:9083</value> <description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description> </property>

另外,幾個默認配置為0.0.0.0的地方不要輕易改動。除非你明確的知道修改的目的,否則請默認設置。

  <property> <name>hive.hwi.listen.host</name> <value>0.0.0.0</value> <description>This is the host address the Hive Web Interface will listen on</description> </property> <property> <name>hive.server2.webui.host</name> <value>0.0.0.0</value> <description>The host address the HiveServer2 WebUI will listen on</description> </property>

尤其是hive.server2.webui.host 不要隨意改動。


如果遇到上述三個問題之外,還是無法鏈接上10000端口的話,記得用以下步驟。

一,先開啟 metastore

hive --service metastore &

二,先開啟 hiveserver2

 hive --service hiveserver2 &

三,可以通過命令netstat -ntulp |grep 10000 
可以看到結果 
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 27799/java


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM