How to access the hadoop distributed environment built in the internal network through the external network

in the hadoop environment built by the company, datanode uses the private network ip,. Only the master node has enabled the external network ip,
now the data on the HDFS is remotely obtained through Java, and the datanode address returned by master to the Java program is the private network ip,
Java. What should I do?

Mar.05,2021

modify the local hosts file to add the mapping relationship between the extranet IP and hostname of namenode and datanode (provided there is an extranet IP)

then set it in the code:

Configuration conf = new Configuration();
conf.set("dfs.client.use.datanode.hostname", "true");

after all, local development is just a test, and it is not recommended to change to the hadoop configuration file.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eae027-219c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eae027-219c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?