问题描述

 我个人的阿里云主机,在上面搭建Hadoop,主要配置如下:

/etc/hosts文件内容:

~etc/hadoop/hdfs-site.xml文件内容

为了方便大家复制粘贴下面是源码

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. -->
<configuration><property><name>dfs.replication</name><value>1</value></property><property><name>dfs.datanode.http.address</name><value>aliyun:50075</value></property><property><name>dfs.datanode.address</name><value>aliyun:50010</value></property>
</configuration>

~etc/hadoop/core-site.xml文件内容:

为了方便大家复制粘贴下面是源码

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. -->
<configuration><property><name>fs.defaultFS</name><value>hdfs://aliyun:9001</value></property><property><name>hadoop.tmp.dir</name><value>/opt/hadoop/hadoop-2.10.1/tmp/</value></property>
</configuration>

启动 datanodenamenode之后,然后访问结果:

还有下面浏览文件的时候准备 download的时候:

百思不得其解:因为在上面的hdfs-site.xml设置dfs.datanode.http.address为aliyun:50075寻思着为什么还是localhost不是aliyun呢?

然后就开始外网上冲浪,外海也去冲浪了,都说要配置hosts文件,我配置了,而且也生效(可以ping自己的域名)了,

然后问一个大佬,他告诉我,你修改一下主机名试试
然后他就让我改一下hostname试试改成aliyun,试试呗,

然后重启 datanodenamenode,其他的都没改动,你猜怎么着?


TMD,全体起立,成了。

然后我就寻思这不科学啊,这尼玛一定要将dfs.datanode.http.address设置成hostname这就离谱,约束性也太强了,而且我配置的时候是根据官方配置文件理解配置的,

这明明写的是Server address 不是hostname(个人认为这个是文档的bug)。然后我寻思着他们好像还有个配置
这里可以指定hostname,后面解释写的是默认是主机当前的hostname,但是也不对啊,我上面查看hostname的时候返回的是iZ2ze5ru3jzfp5m5bmaganZ, 但是Hadoop显示的却是localhost(个人认为是bug),
为了举一反三,我就寻思着既然和hostname有关,刚好dfs.datanode.hostname可以指订hostname,并且将hostname先设置回iZ2ze5ru3jzfp5m5bmaganZ,再在hdfs-site.xml添加dfs.datanode.hostname设置看看会不会生效,操作步骤如下:

  1. 还原hostname
  2. 在hdfs-site.xml添加配置后如下:

为了方便大家复制粘贴下面是源码

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. -->
<configuration><property><name>dfs.replication</name><value>1</value></property><property><name>dfs.datanode.hostname</name><value>aliyun</value></property><property><name>dfs.datanode.http.address</name><value>aliyun:50075</value></property><property><name>dfs.datanode.address</name><value>aliyun:50010</value></property>
</configuration>

然后重启datanodenamenode你猜怎么着,
卧槽 绝了,



举一反三成功。

点击文件下载失败


因为在阿里云上部署的,只能部署内网ip,我上面的hosts的文件配置映射aliyun也是映射的内网,不然根本启动不起来,所以这里你点击download的时候,就会失败,出现下面的画面

因为aliyun上面只能配置内网,所以这里自动跳转的时候的域名也是hadoop上面配置的aliyun:50075,但是你本地没办法解析这个域名,所以要想成功就需要你自己在自己本地的电脑上的hosts文件上面添加

这样就成了,或者你直接


这样就妥了。

Hadoop BUG和采坑集锦—阿里云ECS配置Hadoop, datanode一直显示localhost, 下载文件失败相关推荐

  1. linux(centos8):阿里云ecs配置smtps发邮件(解决不能通过25端口发邮件问题)

    一,2016年9月后购买的阿里云ecs不再支持通过25端口发送邮件 官方的建议是使用465端口 465端口(SMTPS): 465端口是为SMTPS(SMTP-over-SSL)协议服务开放的 它是S ...

  2. anaconda3配置环境变量_阿里云ECS配置Jupyter Notebook

    访问阿里云官网,购买ECS实例成功后,打开管理控制台后就可以看到实例的相关信息: 打开XShell,新建一个会话,输入上图所示的公网IP: 打开刚才新建的会话,输入用户名和密码就可以连接上之前购买的E ...

  3. 阿里云ecs配置ssh

    1.首先在阿里云重建密钥对选择后配对对应的主机 2.先通过阿里云后台重置root密码用ssh工具链接主机,一般要把安全组的端口打开 3.我用的是MobaXterm工具链接,链接以后输入命令 vi /e ...

  4. 阿里云ecs配置报警规则

    1. 云监控控制台 地址: https://cloudmonitor.console.aliyun.com/ 点击主机监控 如果插件状态不是运行中, 可以勾选主机,批量安装或升级插件 2. 添加报警联 ...

  5. 腾讯云COS配置了私有读写,PHP如何下载文件

    /*** 腾讯云PHP计算COS签名* 2021-12-23 10:59:27* @param $uri* @return string*/public static function signCos ...

  6. 阿里云ECS(Centos)中Nginx安装及配置

    Nginx是一个高性能的http和反向代理web服务器,本篇在记录阿里云ECS中安装及配置Nginx的过程.Nginx作为系统关键服务,下面流程全部在root用户下完成. 系统:CentOS 8.0 ...

  7. 阿里云ECS服务器购买及配置,SpringBoot项目部署到阿里云ECS服务器,阿里云ECS服务器安装JDK、Mysql、nginx详细步骤

    1.购买阿里云ECS服务器 官网:阿里云-上云就上阿里云 根据自己的需要选择相应的配置: 目前有一个月的服务器免费体验时间,我选择了免费体验,点击后,可以看到你刚才购买的服务器: 也可以通过这里查看你 ...

  8. 阿里云ESC搭建hadoop集群

    阿里云ESC搭建hadoop集群 前置 购买至少三台服务器,为了节约成本借了两个账号买了三台同一区域的服务器,安装的是 centos7:因此设计到不同账号相同地域之间通讯问题,阿里给了解决方案,详情参 ...

  9. 阿里云ECS服务器部署HADOOP集群(三):ZooKeeper 完全分布式集群搭建

    本篇将在阿里云ECS服务器部署HADOOP集群(一):Hadoop完全分布式集群环境搭建的基础上搭建,多添加了一个 datanode 节点 . 1 节点环境介绍: 1.1 环境介绍: 服务器:三台阿里 ...

最新文章

  1. 远程接入-天翼5系统让ERP穿越时空!
  2. linux——回射服务器多并发(多进程)
  3. 刚刚!第七次人口普查出炉!男性比女性多3490万,老龄化进一步加深
  4. 解决ubuntu18.04中python兼容以及pip兼容问题
  5. c语言接收并回现字符,C语言——字符I/O与缓冲区
  6. 只在用户登陆时运行_linux 系统的7个运行级别
  7. JavaScript中this和$(this)之间的区别以及extend的使用
  8. python 打印unicode字符串
  9. nodejs 实现 磁力链接资源搜索 BT磁力链接爬虫
  10. 软件测试的目的是什么?
  11. 教你30分钟快速搭建直播间
  12. widows上安装golang
  13. Android studio最新版2021安装教程超详细。
  14. uniapp css实现轮播图片逐渐放大效果
  15. Python算法-穷举法和二分法
  16. 关于如何下载E都市三维地图的教程
  17. [C++实现 设计模式(14)] : 门面模式
  18. Git入门到精通(大全)
  19. JZ2440分区表梳理
  20. KMP算法关键点解释

热门文章

  1. 跨时钟域设计(结绳法,脉冲展宽法)
  2. 有工程师思维吗?什么是工程师思维?
  3. 天降大祸于斯人也——幸捡一命,深思我的程序员生涯
  4. 还记得这首是什么歌吗?
  5. 国产小品牌纽麦平板T118的ADB清楚锁屏手势之旅
  6. React全家桶包含哪些
  7. Intouch与PLC通讯
  8. 校园网免认证登录连接软件
  9. ISCC2014--basic+web+misc
  10. Qt去掉最大化最小化按钮和最大化