Hive执行查询报错

执行语句报错 hive (default)> select count(*) from dept;

java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /tmp/hive-beifeng/hive_2018-03-08_14-22-37_242_8757206574090217474-1/-mr-10004/c4c7d70b-9f69-4992-bee9-2c25a1027762/map.xml could only be replicated to 0 nodes instead of minReplication (=1).  There are 0 datanode(s) running and no node(s) are excluded in this operation.
    at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget(BlockManager.java:1503)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:3124)
    at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:636)
    at org.apache.hadoop.hdfs.server.namenode.AuthorizationProviderProxyClientProtocol.addBlock(AuthorizationProviderProxyClientProtocol.java:188)
    at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:476)
    at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:587)
    at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1026)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2013)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2009)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1642)
    at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2007)

    at org.apache.hadoop.hive.ql.exec.Utilities.setBaseWork(Utilities.java:659)
    at org.apache.hadoop.hive.ql.exec.Utilities.setMapWork(Utilities.java:594)
    at org.apache.hadoop.hive.ql.exec.Utilities.setMapRedWork(Utilities.java:587)
    at org.apache.hadoop.hive.ql.exec.mr.ExecDriver.execute(ExecDriver.java:372)
    at org.apache.hadoop.hive.ql.exec.mr.MapRedTask.execute(MapRedTask.java:139)
    at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:155)
    at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:85)
    at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1554)
    at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1321)
    at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1139)
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:962)
    at org.apache.hadoop.hive.ql.Driver.run(Driver.java:952)
    at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:269)
    at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:221)
    at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:431)
    at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:800)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:694)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:633)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
Caused by: org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /tmp/hive-beifeng/hive_2018-03-08_14-22-37_242_8757206574090217474-1/-mr-10004/c4c7d70b-9f69-4992-bee9-2c25a1027762/map.xml could only be replicated to 0 nodes instead of minReplication (=1).  There are 0 datanode(s) running and no node(s) are excluded in this operation.
    at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget(BlockManager.java:1503)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:3124)
    at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:636)
    at org.apache.hadoop.hdfs.server.namenode.AuthorizationProviderProxyClientProtocol.addBlock(AuthorizationProviderProxyClientProtocol.java:188)
    at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:476)
    at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)

原因

namenode和datanode没有正确启动。如果没有配置无秘钥登入就会出现namenode和datanode假启动的问题。

解决

手动启动
sbin/hadoop-daemon.sh start namenode
sbin/hadoop-daemon.sh start datanode

第二种方式:配置无秘钥登入

    原文作者:志辉聊码
    原文地址: https://www.jianshu.com/p/47f0adcd7b2d
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞