如你安好

时间就像海绵里的水,只要愿挤,总还是有的。 -- 鲁迅
如你安好 ,

便是晴天 。

阿里云服务器上HDFS报错:Couldn‘t preview the file.

**问题:

在本地虚拟机上可以正常读文件
在阿里云服务器上报错Couldn’t preview the file.**
1.jpg

造成原因

配置文件hdfs-site.xml配置有误

windows下的C:\Windows\System32\drivers\etc\hosts 没有配置公网ip
这个配置非常重要,一定要配,不能简单理解为在Windows网页端用数字ip就能代替字母ip。

解决方法

在hdfs-site.xml配置如下依赖
dfs.webhdfs.enabled
true

修改windows下的C:\Windows\System32\drivers\etc\hosts的公网ip
注意:Linux上/etc/hosts使用云服务器私网ip,Windows上C:\Windows\System32\drivers\etc\hosts使用云服务器公网ip。
这个配置非常重要,一定要配,不能简单理解为在Windows网页端用数字ip就能代替字母ip。原因:
2.jpg
我的是(ip不便公开,自行补充)
C:\Windows\System32\drivers\etc\hosts(云服务器公网ip)
192.168.0.100 hadoop02
192.168.0.200 hadoop03
192.168.0.300 hadoop04
/etc/hosts(云服务器私网ip)
172.22.135.100 hadoop02
172.22.135.200 hadoop03
172.22.135.300 hadoop04
解决完成
以后每次只需修改C:\Windows\System32\drivers\etc\hosts文件,xshell、idea、网页都可以直接用hadoop02、hadoop03、hadoop04替代

愿望集合地

(仅限登陆用户评论)

这篇文章获得了个赞!