**问题:
在本地虚拟机上可以正常读文件
在阿里云服务器上报错Couldn’t preview the file.**
造成原因
配置文件hdfs-site.xml配置有误
windows下的C:\Windows\System32\drivers\etc\hosts 没有配置公网ip
这个配置非常重要,一定要配,不能简单理解为在Windows网页端用数字ip就能代替字母ip。
解决方法
在hdfs-site.xml配置如下依赖
修改windows下的C:\Windows\System32\drivers\etc\hosts的公网ip
注意:Linux上/etc/hosts使用云服务器私网ip,Windows上C:\Windows\System32\drivers\etc\hosts使用云服务器公网ip。
这个配置非常重要,一定要配,不能简单理解为在Windows网页端用数字ip就能代替字母ip。原因:
我的是(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替代