为什么我的测试集群 运行 处于安全模式?
Why is my test cluster running in safe mode?
我正在测试一些基本的 HDFS 操作,例如创建目录。我的测试中有以下集群配置:
import org.apache.hadoop.fs._
import org.apache.hadoop.fs.permission.FsPermission
import org.apache.hadoop.hdfs.{HdfsConfiguration, MiniDFSCluster}
// ...
private val baseDir = new File("./target/hdfs/test").getAbsoluteFile
private val conf = new HdfsConfiguration()
conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, baseDir.getAbsolutePath)
conf.setInt("dfs.safemode.threshold.pct", 0)
private val builder = new MiniDFSCluster.Builder(conf)
private val cluster = builder.build()
cluster.waitActive()
private val fs = cluster.getFileSystem
private val host = cluster.getNameNode.getHttpAddress.getHostString
private val port = cluster.getNameNodePort
我发现当我 运行 测试时,我发现我总是得到这个错误:
[warn] o.a.h.s.UserGroupInformation - PriviledgedActionException as:erip (auth:SIMPLE) cause:org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot create directory [...]. Name node is in safe mode.
Resources are low on NN. Please add or free up more resources then turn off safe mode manually. NOTE: If you turn off safe mode before adding resources, the NN will immediately return to safe mode. Use "hdfs dfsadmin -safemode leave" to turn safe mode off.
紧随其后...
[info] org.apache.hadoop.ipc.RemoteException: Cannot create directory [...]. Name node is in safe mode.
[info] Resources are low on NN. Please add or free up more resources then turn off safe mode manually. NOTE: If you turn off safe mode before adding resources, the NN will immediately return to safe mode. Use "hdfs dfsadmin -safemode leave" to turn safe mode off.
我正在 运行 建立一个内存中的集群,所以我不知道为什么会看到这个。我以为设置 "dfs.safemode.threshold.pct"
会阻止我看到这个基于 this answer 的错误,但我错了。
为什么我的内存测试集群 运行 处于安全模式?我如何阻止它这样做?
使用下面的命令退出安全模式 运行 任何命令-
hadoop dfsadmin -safemode leave
其他与安全模式相关的命令是
hadoop dfadmin -safemode get
获取系统的当前运行状态
问题出在 cluster.waitActive()
, which waits for the name nodes to be ready. This should have been cluster.waitClusterUp()
,它明确等待集群退出安全模式。
我正在测试一些基本的 HDFS 操作,例如创建目录。我的测试中有以下集群配置:
import org.apache.hadoop.fs._
import org.apache.hadoop.fs.permission.FsPermission
import org.apache.hadoop.hdfs.{HdfsConfiguration, MiniDFSCluster}
// ...
private val baseDir = new File("./target/hdfs/test").getAbsoluteFile
private val conf = new HdfsConfiguration()
conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, baseDir.getAbsolutePath)
conf.setInt("dfs.safemode.threshold.pct", 0)
private val builder = new MiniDFSCluster.Builder(conf)
private val cluster = builder.build()
cluster.waitActive()
private val fs = cluster.getFileSystem
private val host = cluster.getNameNode.getHttpAddress.getHostString
private val port = cluster.getNameNodePort
我发现当我 运行 测试时,我发现我总是得到这个错误:
[warn] o.a.h.s.UserGroupInformation - PriviledgedActionException as:erip (auth:SIMPLE) cause:org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot create directory [...]. Name node is in safe mode.
Resources are low on NN. Please add or free up more resources then turn off safe mode manually. NOTE: If you turn off safe mode before adding resources, the NN will immediately return to safe mode. Use "hdfs dfsadmin -safemode leave" to turn safe mode off.
紧随其后...
[info] org.apache.hadoop.ipc.RemoteException: Cannot create directory [...]. Name node is in safe mode.
[info] Resources are low on NN. Please add or free up more resources then turn off safe mode manually. NOTE: If you turn off safe mode before adding resources, the NN will immediately return to safe mode. Use "hdfs dfsadmin -safemode leave" to turn safe mode off.
我正在 运行 建立一个内存中的集群,所以我不知道为什么会看到这个。我以为设置 "dfs.safemode.threshold.pct"
会阻止我看到这个基于 this answer 的错误,但我错了。
为什么我的内存测试集群 运行 处于安全模式?我如何阻止它这样做?
使用下面的命令退出安全模式 运行 任何命令-
hadoop dfsadmin -safemode leave
其他与安全模式相关的命令是
hadoop dfadmin -safemode get
获取系统的当前运行状态
问题出在 cluster.waitActive()
, which waits for the name nodes to be ready. This should have been cluster.waitClusterUp()
,它明确等待集群退出安全模式。