一个80后
程序员的笔记

[CentOS7]挂载HDFS(HDFS NFS Gateway)

1、安装依赖包

yum install -y showmount

2、修改配置文件

/usr/local/hadoop/etc/hadoop/core-site.xml

vim /usr/local/hadoop/etc/hadoop/core-site.xml
#添加以下配置
<property>
    <name>hadoop.proxyuser.root.groups</name>
    <value>*</value>
    <description>
         The 'nfsserver' user is allowed to proxy all members of the 'users-group1' and
         'users-group2' groups. Note that in most cases you will need to include the
         group "root" because the user "root" (which usually belonges to "root" group) will
         generally be the user that initially executes the mount on the NFS client system.
         Set this to '*' to allow nfsserver user to proxy any group.
    </description>
    </property>
    <property>
    <name>hadoop.proxyuser.root.hosts</name>
    <value>*</value>
    <description>
         This is the host where the nfs gateway is running. Set this to '*' to allow
         requests from any hosts to be proxied.
    </description>
    </property>

/usr/local/hadoop/etc/hadoop/hdfs-site.xml

vim /usr/local/hadoop/etc/hadoop/hdfs-site.xml
#添加以下配置
<property>
        <name>nfs.dump.dir</name>
        <value>/tmp/.hdfs-nfs</value>
    </property>
    <property>
        <name>nfs.rtmax</name>
        <value>1048576</value>
        <description>This is the maximum size in bytes of a READ request supported by the NFS gateway. If you change this, make sure you also update the nfs mount's rsize(add rsize= # of bytes to the mount directive).</description>
    </property>
    <property>
        <name>nfs.wtmax</name>
        <value>65536</value>
        <description>This is the maximum size in bytes of a WRITE request supported by the NFS gateway. If you change this, make sure you also update the nfs mount's wsize(add wsize= # of bytes to the mount directive).</description>
    </property>
    <property>
        <name>nfs.exports.allowed.hosts</name>
        <value>* rw</value>
        <description>允许所有主机对文件有rw权限</description>
    </property>

3、重启hadoop

sbin/stop-all.sh
sbin/start-all.sh

4、启动hadoop nfs

systemctl stop rpcbind
systemctl stop nfs
#这里需要重启主机,否则portmap会启动失败,原因是111端口还是在被使用
sbin/hadoop-daemon.sh --script bin/hdfs start portmap
sbin/hadoop-daemon.sh --script bin/hdfs start nfs3

5、挂载

mount -t nfs -o vers=3,proto=tcp,nolock,noacl,sync 192.168.40.50:/  /mnt/hdfs
赞(29) 打赏
未经允许不得转载:笨笨天地 » [CentOS7]挂载HDFS(HDFS NFS Gateway)
分享到: 更多 (0)

相关推荐

  • 暂无文章

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏