linux—结合使用hbase和hdfs会导致makedironfilesystem出现异常

4xrmg8kj  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(385)

介绍
尝试合并hbase和hdfs会导致以下结果:

2014-06-09 00:15:14,777 WARN org.apache.hadoop.hbase.HBaseFileSystem: Create Dir
ectory, retries exhausted
2014-06-09 00:15:14,780 FATAL org.apache.hadoop.hbase.master.HMaster: Unhandled
exception. Starting shutdown.
java.io.IOException: Exception in makeDirOnFileSystem
        at org.apache.hadoop.hbase.HBaseFileSystem.makeDirOnFileSystem(HBaseFile
System.java:136)
        at org.apache.hadoop.hbase.master.MasterFileSystem.checkRootDir(MasterFi
leSystem.java:428)
        at org.apache.hadoop.hbase.master.MasterFileSystem.createInitialFileSyst
emLayout(MasterFileSystem.java:148)
        at org.apache.hadoop.hbase.master.MasterFileSystem.<init>(MasterFileSyst
em.java:133)
        at org.apache.hadoop.hbase.master.HMaster.finishInitialization(HMaster.j
ava:572)
        at org.apache.hadoop.hbase.master.HMaster.run(HMaster.java:432)
        at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.hadoop.security.AccessControlException: Permission denied:
 user=hbase, access=WRITE, inode="/":vagrant:supergroup:drwxr-xr-x
        at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPe
rmissionChecker.java:224)
        at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(FSPe
rmissionChecker.java:204)
        at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermi
ssion(FSPermissionChecker.java:149)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkPermission(F
SNamesystem.java:4891)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkPermission(F
SNamesystem.java:4873)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.checkAncestorAcce
ss(FSNamesystem.java:4847)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.mkdirsInternal(FS
Namesystem.java:3192)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.mkdirsInt(FSNames
ystem.java:3156)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.mkdirs(FSNamesyst
em.java:3137)
        at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.mkdirs(NameN
odeRpcServer.java:669)
        at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTra
nslatorPB.mkdirs(ClientNamenodeProtocolServerSideTranslatorPB.java:419)
        at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$Cl
ientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java:4497
0)
        at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.cal
l(ProtobufRpcEngine.java:453)
        at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1002)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1752)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1748)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInforma
tion.java:1438)
        at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1746)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
        at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteExce
ption.java:90)
        at org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteExc
eption.java:57)
        at org.apache.hadoop.hdfs.DFSClient.primitiveMkdir(DFSClient.java:2153)
        at org.apache.hadoop.hdfs.DFSClient.mkdirs(DFSClient.java:2122)
        at org.apache.hadoop.hdfs.DistributedFileSystem.mkdirs(DistributedFileSy
stem.java:545)
        at org.apache.hadoop.fs.FileSystem.mkdirs(FileSystem.java:1915)
        at org.apache.hadoop.hbase.HBaseFileSystem.makeDirOnFileSystem(HBaseFile
System.java:129)
        ... 6 more

配置和系统设置如下:

[vagrant@localhost hadoop-hdfs]$ hadoop fs -ls hdfs://localhost/
Found 1 items
-rw-r--r--   3 vagrant supergroup 1010827264 2014-06-08 19:01 hdfs://localhost/u
buntu-14.04-desktop-amd64.iso
[vagrant@localhost hadoop-hdfs]$

/etc/hadoop/conf/core-site.xml文件

<configuration>
  <property>
    <name>fs.defaultFS</name>
    <value>hdfs://localhost:8020</value>
  </property>
</configuration>

/etc/hbase/conf/hbase-site.xml文件

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://localhost:8020/hbase</value>
  </property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
</configuration>

/etc/hadoop/conf/hdfs-site.xml文件

<configuration>
  <property>
    <name>dfs.name.dir</name>
    <value>/var/lib/hadoop-hdfs/cache</value>
  </property>
  <property>
    <name>dfs.data.dir</name>
    <value>/tmp/hellodatanode</value>
  </property>
</configuration>

namenode目录权限

[vagrant@localhost hadoop-hdfs]$ ls -ltr /var/lib/hadoop-hdfs/cache
total 8
-rwxrwxrwx. 1 hbase hdfs   15 Jun  8 23:43 in_use.lock
drwxrwxrwx. 2 hbase hdfs 4096 Jun  8 23:43 current
[vagrant@localhost hadoop-hdfs]$
``` `HMaster` 能够启动,如果 `fs.defaultFS` 属性已在中注解
core-site.xml `NameNode` 他在听

[vagrant@localhost hadoop-hdfs]$ netstat -nato | grep 50070
tcp 0 0 0.0.0.0:50070 0.0.0.0:* LIST
EN off (0.00/0/0)
tcp 0 0 33.33.33.33:50070 33.33.33.1:57493 ESTA
BLISHED off (0.00/0/0)

并可通过导航到 `http://33.33.33.33:50070/dfshealth.jsp` .
问题
如何解决 `makeDirOnFileSystem` 异常并让hbase连接到hdfs?
qojgxg4l

qojgxg4l1#

您只需要知道堆栈跟踪的这一行:
原因:org.apache.hadoop.security.accesscontrolexception:权限被拒绝:user=hbase,access=write,inode=“/”:vagrant:supergroup:drwxr-xr-x
用户 hbase 没有写入hdfs根目录的权限( / )因为它属于 vargrant 并且设置为只允许所有者对其进行写入。
使用 hadoop fs -chmod 修改权限。
编辑:
您还可以成功地创建目录 /hbase 设置 hbase 用户作为所有者。这样你就不必允许 hbase 写到根上。

相关问题