Get HDFS cluster name Spring Boot Yarn

Let’s say you need to get the name of hdfs cluster in an application. To do this, you need to get the org.apache.hadoop.conf.Configuration object:

@Autowired
Configuration conf;

In the place we need, we get the fs.defaultFS property value:

String hdfsName = conf.get("fs.defaultFS");
log.info("HDFS cluster name = " + name);

If you still have any questions, feel free to ask me in the comments under this article, or write me on promark33@gmail.com.

If I saved your day, you can support me :)

Leave a Reply

Your email address will not be published.