Find port number where HDFS is listening

谁说我不能喝 提交于 2019-12-02 17:10:37

Below command available in Apache hadoop 2.7.0 onwards, this can be used for getting the values for the hadoop configuration properties. fs.default.name is deprecated in hadoop 2.0, fs.defaultFS is the updated value. Not sure whether this will work incase of maprfs.

hdfs getconf -confKey fs.defaultFS  # ( new property ) 

or

hdfs getconf -confKey fs.default.name    # ( old property ) 

Not sure whether there is any command line utilities available for retrieving configuration properties values in Mapr or hadoop 0.20 hadoop versions. In case of this situation you better try the same in Java for retrieving the value corresponding to a configuration property.

Configuration hadoop conf = Configuration.getConf();
System.out.println(conf.get("fs.default.name"));

fs.default.name is deprecated.

use : hdfs getconf -confKey fs.defaultFS

I encountered this answer when I was looking for HDFS URI. Generally that's a URL pointing to the namenode. While hdfs getconf -confKey fs.defaultFS gets me the name of the nameservice but it won't help me building the HDFS URI.

I tried the command below to get a list of the namenodes instead

 hdfs getconf -namenodes

This gave me a list of all the namenodes, primary first followed by secondary. After that constructing the HDFS URI was simple

hdfs://<primarynamenode>/

you can use

hdfs getconf -confKey fs.default.name

Yes, hdfs getconf -namenodes will show list of namenodes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!