Cannot create directory tmphadoop-yarnstagingroot.staging. Name node is in safe mode.

it2022-05-06  4

利用 sqoop从mysql导入数据到hadoop 中出现以下错误:  

19/07/28 07:47:43 ERROR tool.ImportTool: Import failed: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hdfs.server.namenode.SafeModeException): Cannot create directory /tmp/hadoop-yarn/staging/root/.staging. Name node is in safe mode. The reported blocks 20 needs additional 3 blocks to reach the threshold 0.9990 of total blocks 23. The number of live datanodes 2 has reached the minimum number 0. Safe mode will be turned off automatically once the thresholds have been reached.     at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkNameNodeSafeMode(FSNamesystem.java:1335)     at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.mkdirs(FSNamesystem.java:3866)     at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.mkdirs(NameNodeRpcServer.java:984)     at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.mkdirs(ClientNamenodeProtocolServerSideTranslatorPB.java:634)     at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)     at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:616)     at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:982)     at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2217)     at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2213)     at java.security.AccessController.doPrivileged(Native Method)     at javax.security.auth.Subject.doAs(Subject.java:422)     at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1754)     at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2213)

    at org.apache.hadoop.ipc.Client.call(Client.java:1476)     at org.apache.hadoop.ipc.Client.call(Client.java:1413)     at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229)     at com.sun.proxy.$Proxy10.mkdirs(Unknown Source)     at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.mkdirs(ClientNamenodeProtocolTranslatorPB.java:563)     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:191)     at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)     at com.sun.proxy.$Proxy11.mkdirs(Unknown Source)     at org.apache.hadoop.hdfs.DFSClient.primitiveMkdir(DFSClient.java:3014)     at org.apache.hadoop.hdfs.DFSClient.mkdirs(DFSClient.java:2984)     at org.apache.hadoop.hdfs.DistributedFileSystem$21.doCall(DistributedFileSystem.java:1047)     at org.apache.hadoop.hdfs.DistributedFileSystem$21.doCall(DistributedFileSystem.java:1043)     at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)     at org.apache.hadoop.hdfs.DistributedFileSystem.mkdirsInternal(DistributedFileSystem.java:1061)     at org.apache.hadoop.hdfs.DistributedFileSystem.mkdirs(DistributedFileSystem.java:1036)     at org.apache.hadoop.mapreduce.JobSubmissionFiles.getStagingDir(JobSubmissionFiles.java:133)     at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:144)     at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1290)     at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1287)     at java.security.AccessController.doPrivileged(Native Method)     at javax.security.auth.Subject.doAs(Subject.java:422)     at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1754)     at org.apache.hadoop.mapreduce.Job.submit(Job.java:1287)     at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1308)     at org.apache.sqoop.mapreduce.ImportJobBase.doSubmitJob(ImportJobBase.java:200)     at org.apache.sqoop.mapreduce.ImportJobBase.runJob(ImportJobBase.java:173)     at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:270)     at org.apache.sqoop.manager.SqlManager.importTable(SqlManager.java:692)     at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:520)     at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628)     at org.apache.sqoop.Sqoop.run(Sqoop.java:147)     at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)     at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)     at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)     at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)     at org.apache.sqoop.Sqoop.main(Sqoop.java:252)

这是因为hadoop 被我设置成了  safe mode,

 

这是说明NameNode处于安全模式

那么为什么NameNode会处于安全模式呢

1、NameNode发现集群中DataNode丢失达到一定比例(0.01%)时会进入安全模式,此时只允许查看数据不允许对数据进行任何操作。

2、HDFS集群即使启动正常,启动只会依旧会进入安全模式一段时间,这时你不需要理会他,稍等片刻即可。

3、集群升级维护时手动进入安全模式吗,命令如下

hadoop dfsadmin -safemode enter

那么如何退出安全模式呢?

使用命令

hadoop dfsadmin -safemode leave


最新回复(0)