Purpose: It is simple, convenient and fast to access Hadoop files in a way that is similar to accessing local disks by mounting.
0. System version &hadoop version
1) System version
[root@WEB-W031 sbin]# cat /etc/issueCentOS5.8 (Final)
2) Hadoop version
[Email protected]/]# Hadoop versionhadoop2.7.2Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git-r b165c4fe8a74265c792ce23f546c64604acf0e41Compiled byJenkins on .- on- -T00: ,Zcompiled withProtoc2.5.0 fromSource withChecksum d0fda26633fa762bff87ec759ebe689cthis Command was runusing/home/hadoop/hadoop/share/hadoop/common/hadoop-common-2.7.2. Jaryou hasNewMailinch/var/spool/mail/root
1. Configuring the Core-site.xml File
< Property> <name>hadoop.proxyuser.hadoop.groups</name> <value>*</value> <description> the ' nfsserver ' user isAllowed toProxy all Members of the' Users-group1 ' and' Users-group2 ' groups. Note that inchMost cases you'll need toInclude theGroup"Root"Because theUser"Root"(which usually belonges to "Root"Group) would generally be theUser thatInitially executes theMount on theNFS client system. Set this to‘*‘ toAllow NFSServer user toProxy any group. </description></ Property>< Property> <name>hadoop.proxyuser.hadoop.hosts</name> <value>*</value> <description> This is theHostwhere theNFS Gateway is Running. Set this to‘*‘ toAllow requests fromAny hosts toBe proxied. </description></ Property>
Meaning interpretation:
1) Hadoop.proxyuser.hadoop.groups: The second is the same as the user name that performs Hadoop, and the name of this test is Hadoop.
2) Hadoop.proxyuser.hadoop.hosts: The second is the same as the user name that performs Hadoop, and the name of this test is Hadoop.
2. Configuring the Hdfs-site.xml File
< Property> <name>dfs.namenode.accesstime.precision</name> <value>3600000</value> <description>the Access Time forHdfsfile isPrecise upto this value. The default value is 1Hour. Setting a value of 0Disables access Times forHdfs. </description></ Property> < Property> <name>nfs.dump.dir</name> <value>/tmp/.hdfs-nfs</value> </ Property>< Property> <name>nfs.exports.allowed.hosts</name> <value>* rw</value></ Property>< Property> <name>nfs.rtmax</name> <value>1048576</value> <description>this is theMaximum sizeinchbytes ofA READ request supported by theNFS Gateway. If you change this, make sure also update theNFS Mount ' s rsize (add rsize=# of bytes to the Mount Directive) .</description></ Property>< Property> <name>nfs.wtmax</name> <value>65536</value> <description>this is theMaximum sizeinchbytes ofA WRITE request supported by theNFS Gateway. If you change this, make sure also update theNFS Mount ' s wsize (add wsize=# of bytes to the Mount Directive) .</description></ Property>
3, Configuration */etc/hadoop/log4j.properties
log4j.logger.org.apache.hadoop.hdfs.nfs=DEBUG log4j.logger.org.apache.hadoop.oncrpc=DEBUG
4, Root user stop Portmap (Centos 5.X System), stop NFS
[root@WEB-W031 etc]# service portmap stopStoppingportmap:OK ][root@WEB-W031 hadoop]# service nfs stop
Note: 5. The Portmap of X is equivalent to the rpcbind on the 6.X
And through: Service NFS status verification has ended.
and pass: The service Portmap status verifies whether it has ended.
5. Portmap Service for Hadoop (requires root access)
[root]> /sbin/hadoop-daemon.sh–script /bin/hdfs start Portmap
6. Open Hadoop NFS3 Service (need to perform Hadoop user rights, this system is Hadoop)
[hadoop]$ /sbin/hadoop-daemon.sh–script /bin/hdfs start NFS3
7. Turn on Hadoop and verify (
Need to perform Hadoop user rights, this system is Hadoop
[[email protected] sbin]# ./start-dfs.sh[[email protected] sbin]# jps14728 ResourceManager27478 Jps5228 Portmap14104 NameNode14373 SecondaryNameNode16762 org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar13512 Nfs3
8. Verify that the NFS-related services are started successfully
1) Verify that the services are running successfully
[Root@WEB-W031Hadoop# rpcinfo-p $nfs _server_ipprogram Vers Proto Port100005 2Tcp4242Mountd100000 2Udp111Portmapper100000 2Tcp111Portmapper100005 1Tcp4242Mountd100003 3Tcp2049Nfs100005 1Udp4242Mountd100005 3Udp4242Mountd100005 3Tcp4242Mountd
2) Verify that the mount is successful
[root@WEB-W031 hadoop]# showmount -e $nfs_server_ipExportforWEB-W031:/ *
9, the implementation of the Mount
[root]>mount -t nfs -o vers=3$10.0.1.31:/ /hdfsnew
10. See if the mount is successful
[Root@WEB-W031Hdfsnew]# Ls-alTotalTenDrwxr-xr-x5Root2584148964 the Mar One09: +. drwxr-xr-x toRoot root4096 Mar One Ten: +.. Drwxr-xr-x3Root root the Mar One09: -TESTINGDRWXRWX---3Hadoop2584148964 the Mar 9 One: -Tmpdrwxr-xr-x3Hadoop2584148964 the Mar 9 -: -User[root@WEB-W031Hdfsnew]# CD testing/[Root@WEB-W031Testing]# Ls-alTotal2Drwxr-xr-x3Root root the Mar One09: -. drwxr-xr-x5Root2584148964 the Mar One09: +.. -rw-rw-r--1Hadoop Hadoop - Mar One Ten:Dffafdadafasdfaf[root@WEB-W031Testing]# echo "Testinglaoyang" > Testlaoyang[Root@WEB-W031Testing]# Ls-alTotal2Drwxr-xr-x4Root root - Mar One -: to. drwxr-xr-x5Root2584148964 the Mar One09: +.. -rw-rw-r--1Hadoop Hadoop - Mar One Ten:dffafdadafasdfaf-rw-r--r--1Root root the Mar One -: toTestlaoyang
10. Access Effect
12. End of service
1) End of NFS3 service (must be consistent with starting Hadoop users)
[hadoop]$ */sbin/hadoop-daemon.sh --script */bin/hdfs stop nfs3
2) End of Portmap service (must be root user)
[root]> */sbin/hadoop-daemon.sh --script */bin/hdfs start portmap
3) End of Hadoop (must be consistent with starting Hadoop users)
"'
[Email protected] sbin]#./stop-dfs.sh
13. Frequently Asked Questions
Java process takes up 111 ports
[Email protected] etc]# lsof-i:111
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
Java 31206 root 474u IPv4 93384812 0t0 TCP *:sunrpc (LISTEN)
Java 31206 root 476u IPv4 93384815 0t0 UDP *:sunrpc
“
Solution: Kill-9 31206
Error details
[Email protected] sbin]# mount-t nfs-o vers=3,proto=tcp,nolock,noacl,sync localhost://hdfs_y
mount.nfs:input/output Error
Note: Be sure to note the details of the configuration file.
Solution:
http://stackoverflow.com/questions/35910751/hdfs-nfs-gateway-mount-nfs-input-output-error/35935229#35935229
Reference:
Https://hadoop.apache.org/docs/r2.7.2/hadoop-project-dist/hadoop-hdfs/HdfsNfsGateway.html#Allow_mounts_from_ Unprivileged_clients
http://tianxingzhe.blog.51cto.com/3390077/1650182
Ming Yi World
Reprint please indicate source, original address: http://blog.csdn.net/laoyang360/article/details/50865025
If you feel this article is helpful, please click on the ' top ' support, your support is I insist on writing the most power, thank you!
Hadoop NFS Gateway deployment in depth