今天用阿里的服务器搭了个伪分布式的HDFS,格式化后启动hdfs,发现只有dataNode启动了,查看启动日志发现异常:

2019-01-22 15:54:50,507 FATAL org.apache.hadoop.hdfs.server.namenode.NameNode: Failed to start namenode.
java.net.BindException: Problem binding to [node01:9000] java.net.BindException: Cannot assign requested address; For more details see: http://wiki.apache.org/hadoop/BindException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:791)
at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:720)
at org.apache.hadoop.ipc.Server.bind(Server.java:424)
at org.apache.hadoop.ipc.Server$Listener.<init>(Server.java:573)
at org.apache.hadoop.ipc.Server.<init>(Server.java:2206)
at org.apache.hadoop.ipc.RPC$Server.<init>(RPC.java:944)
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server.<init>(ProtobufRpcEngine.java:537)
at org.apache.hadoop.ipc.ProtobufRpcEngine.getServer(ProtobufRpcEngine.java:512)
at org.apache.hadoop.ipc.RPC$Builder.build(RPC.java:789)
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.<init>(NameNodeRpcServer.java:331)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createRpcServer(NameNode.java:627)
at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:600)
at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:765)
at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:749)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1446)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1512)

针对找个异常,首先是要确定自己的配置文件有没有配置错误,检查了一遍没错呀。然后就去官网看看什么原因(点击查看官网关于此异常介绍),官网上的内容如下:

根据官网介绍,出现这种情况要么是9000端口被占用了,要么就是hdfs在EC2上运行,那么hdfs服务将尝试使用公共主机名或IP显式绑定公共弹性IP地址,或者隐式使用“0.0.0.0”作为地址。

首先看看9000端口有没有被占用,输入官网提供的指令: netstat -a -t --numeric-ports -p,发现9000端口并没有被占用,那么就是第二个原因了。百度了一下阿里的ECS服务器无法绑定公网IP的地址,细心的人应该能发现连接服务器的ip和你连接服务器后,输入ifconfig显示的ip地址不一致。如下图,可以看到网段都不一样:

所以要解决这个BindException,直接修改/etc/hosts文件:

内网IP地址 hostname1
公网IP地址 hostname2

注意:内网IP对应的hostname要和hadoop的配置文件core-site.xml的hostname对应。

<property>
<name>fs.defaultFS</name>
<value>hdfs://node01:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/var/abc/hadoop/local</value>
</property>

修改完成后重新格式化,hdfs就可以正常启动了。

Centos7-搭建hdfs启动时报java.net.BindException: Problem binding to [node01:9000] java.net.BindException异常的更多相关文章

  1. java.net.BindException: Problem binding to [hadoop103:8031] java.net.BindException

    ResourceManger启动失败,Namenode启动成功,这个问题排查了好久 在hadoop-2.7.6/logs/yarn-root-resourcemanager-hadoop102.log ...

  2. Problem binding to [bigdata-server-01:9000] java.net.BindException: Cannot assign requested address;

    If the port is "0", then the OS is looking for any free port -so the port-in-use and port- ...

  3. java.net.BindException: Problem binding to [node2:45454] java.net.BindException: Cannot assign requested address

    主要原因是网络的问题.可参考官方给出的详细解释. http://wiki.apache.org/hadoop/BindException 总之,这是网络或者配置网络的问题,跟 hadoop 基本没有关 ...

  4. MyEclipse for Spring启动时报错"An internal error occurred during: 'Updating indexes'.Java heap space"的解决办法

    问题 MyEclipse for Spring在启动时,报如下错误:An internal error occurred during: 'Updating indexes'.Java heap sp ...

  5. 项目启动时报错Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError

    https://www.cnblogs.com/liuyp-ken/p/7911536.html 解决过程: 1.检查配置,反反复复看了很多遍,确认没有问题. 2. 网上找了很多资料,类似的问题很多, ...

  6. springmvc启动时报错:找不到类ContextLoaderListener:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderLis ...

  7. java.net.BindException:Problem binding to [hostname:8088]地址已在使用

    异常提示端口号被占用 查找被占用的端口 netstat -tln netstat -tln | grep 8083 netstat -tln ## 查看端口使用情况,而netstat -tln | g ...

  8. Tomcat启动时报错:java.net.BindException: Permission denied <null>:80 【转载】

    本文转载自: http://blog.sina.com.cn/s/blog_4550f3ca0101g37l.html   问题起因:做负载均衡时需要将Web工程与Wap工程同时部署在一台Suse服务 ...

  9. Jenkins启动时报错:java.net.BindException: Address already in use: bind 解决方法

    下载jenkins.war包后,进入Jenkins.war包目录下,运行java -jar jenkins.war时报端口被占用的错误:java.net.BindException: Address ...

随机推荐

  1. HDU——4291A Short problem(矩阵快速幂+循环节)

    A Short problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  2. 【CCF】高速公路 tarjan强连通缩点

    [题意] 给定一个有向图,问图中互相可达(强连通)的点有多少对 [AC] 强连通缩点,缩点后是一个DAG,所以互相可达的点只在强连通块里. #include<iostream> #incl ...

  3. java面试题之volatile的工作原理

    volatile的特性: volatile可见性:对一个volatile的读,总可以看到对这个变量最终的写: volatile原子性:volatile对单个读/写具有原子性(32位Long.Doubl ...

  4. 怎样抓获或忽略像control-C这样的键盘中断?

    基本步骤是调用signal():#include <signal.h>singal(SIGINT, SIG_IGN); 就可以忽略中断信号, 或者:extern void func(int ...

  5. 變更 cut-off,termination current,截止電流 對 battery capacity 的影響

    依之前的經驗 2700mAh 電池 cut-off 由 128 降至 64 mA,充電時間延長 20 分鐘, (128 + 64)/2 = 96 取平均充電流, 96 * (20/60) = 32 m ...

  6. 现象: shell脚本中source aaa.sh时提示 source: not found

    原因: ls -l `which sh` 提示/bin/sh -> dash 这说明是用dash来进行解析的. 改回方法: 命令行执行:sudo dpkg-reconfigure dash 在界 ...

  7. C#实现键盘钩子

    前言: 因为项目中需要使用到快捷键,所以上网找资料了解关于快捷键的实现技术,于是有了键盘钩子的使用学习.在网上了解到,键盘钩子其实只是很多种钩子中的其中一种.所谓钩子:请看下面关于钩子的描述(来自百度 ...

  8. AC日记——Milking Grid poj 2185

    Milking Grid Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 8314   Accepted: 3586 Desc ...

  9. Oracle 12c JDBC方式连接PDB数据库

    1.配置监听 这里假定CDB数据库名为ORCL,PDB在CDB下面名称为PDBORCLlistener.ora添加(#后面为注释,不要添加进去) SID_LIST_LISTENER = (SID_LI ...

  10. mysql数据库引擎(InnoDB MyISAM)

    MySQL的默认存储引擎’在5.5版本以前是MYISAM,5.5之后是INNODB. 两种存储引擎的索引结构都是B+树,B+树的详细介绍可参考https://www.cnblogs.com/yange ...