本地开发环境springboot项目中链接内网中hadoop集群,namenode使用外网连接没问题,但是上传文件时,通过namenode找datanode时就自动变为内网ip了,这样肯定不行的。

卡了两天。。

偶然间发现一篇文章:https://blog.csdn.net/qq_36951116/article/details/90348181?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param

最后就是在开发的机器上(我的是windows10环境)在hosts文件中加入datanode主机名映射

1.在配置文件位置加入一行代码

conf.set("dfs.client.use.datanode.hostname", "true");//让namenode返回datanode所在机器的hostname
获取datanode机器的主机名

外网连接内网hadoop集群

 

 

windows10   hosts文件位置:C:\windows\system32\drivers\etc\

2.在hosts文件中加入datanode主机名映射如下图:

外网连接内网hadoop集群

 

相关文章:

  • 2022-12-23
  • 2021-12-08
  • 2021-10-31
  • 2021-06-20
  • 2021-12-18
  • 2021-08-17
  • 2021-11-28
  • 2022-12-23
猜你喜欢
  • 2021-04-25
  • 2021-04-22
  • 2022-12-23
  • 2021-05-24
  • 2021-06-17
  • 2021-06-16
  • 2022-12-23
相关资源
相似解决方案