重啟虛擬機后,Hive無法啟動,如何解決?


報錯:

Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Call From bigdata/192.168.0.108 to bigdata:9000 failed on socket exception: java.net.SocketException: Network is unreachable; For more details see:  http://wiki.apache.org/hadoop/SocketException
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:610)
    at org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:553)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:750)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:686)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:244)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:158)
Caused by: java.net.SocketException: Call From bigdata/192.168.0.108 to bigdata:9000 failed on socket exception: java.net.SocketException: Network is unreachable; For more details see:  http://wiki.apache.org/hadoop/SocketException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:824)
    at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:797)
    at org.apache.hadoop.ipc.Client.getRpcResponse(Client.java:1544)
    at org.apache.hadoop.ipc.Client.call(Client.java:1486)
    at org.apache.hadoop.ipc.Client.call(Client.java:1385)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:232)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:118)
    at com.sun.proxy.$Proxy29.getFileInfo(Unknown Source)
    at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo(ClientNamenodeProtocolTranslatorPB.java:800)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:422)
    at org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invokeMethod(RetryInvocationHandler.java:165)
    at org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invoke(RetryInvocationHandler.java:157)
    at org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invokeOnce(RetryInvocationHandler.java:95)
    at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:359)
    at com.sun.proxy.$Proxy30.getFileInfo(Unknown Source)
    at org.apache.hadoop.hdfs.DFSClient.getFileInfo(DFSClient.java:1652)
    at org.apache.hadoop.hdfs.DistributedFileSystem$29.doCall(DistributedFileSystem.java:1523)
    at org.apache.hadoop.hdfs.DistributedFileSystem$29.doCall(DistributedFileSystem.java:1520)
    at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
    at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1520)
    at org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1627)
    at org.apache.hadoop.hive.ql.session.SessionState.createRootHDFSDir(SessionState.java:708)
    at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:654)
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:586)
    ... 9 more
Caused by: java.net.SocketException: Network is unreachable
    at sun.nio.ch.Net.connect0(Native Method)
    at sun.nio.ch.Net.connect(Net.java:454)
    at sun.nio.ch.Net.connect(Net.java:446)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
    at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:192)
    at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531)
    at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:701)
    at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:805)
    at org.apache.hadoop.ipc.Client$Connection.access$3700(Client.java:423)
    at org.apache.hadoop.ipc.Client.getConnection(Client.java:1601)
    at org.apache.hadoop.ipc.Client.call(Client.java:1432)
    ... 33 more

 解決方案:重啟NetworkManager

[root@bigdata tmp]# systemctl restart NetworkManager
[root@bigdata tmp]# ping www.baidu.com
PING www.a.shifen.com (180.101.49.12) 56(84) bytes of data.
64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=1 ttl=52 time=11.1 ms

 

其他:

HIVE關閉、開啟:

1.關閉

可以通過ps -ef|grep hive 來看hive 的端口號,然后kill 掉相關的進程。

kill -9 xxx

2.啟動

nohup hive --service metastore  2>&1 &  

用來啟動metastore

nohup  hive --service hiveserver2   2>&1 & 

用來啟動hiveserver2

可以通過查看日志,來確認是否正常啟動。

注意!如果 hiveserver2 不啟動,jdbc將無法正常連接


ref:https://www.jianshu.com/p/7b1b21bf05c2

 

centos 中,使用ss命令代替netstat查找端口號的進程
[hadoop ~]# ss -lnp|grep 9083

[hadoop ~]# ss -lnp|grep 10000

 

---------------------

 

hadoop參數設置完后,需要重啟hadoop

$HADOOP_HOME/sbin/stop-dfs.sh
$HADOOP_HOME/sbin/start-dfs.sh


啟動hiveserver2
$HIVE_HOME/bin/hive --service hiveserver2
OR

>hiveserver2

hiveserver2啟動后,jps 顯示會有Runjar

 

 


beeline工具測試使用jdbc方式連接
$HIVE_HOME/bin/beeline -u jdbc:hive2://localhost:10000

or

>beeline

>!connect jdbc:hive2://localhost:10000


hiveserver端口號默認是10000
使用beeline通過jdbc連接上之后就可以像client一樣操作。
————————————————
ref:https://blog.csdn.net/lblblblblzdx/article/details/79760959


免責聲明!

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



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