今天在新电脑上安装虚拟机的时候,尝试打开hadoop和hbase,hadoop打开没有问题,就是hbase关闭的时候报了stopping hbasecat:/tmp/hbase-root-master.pid:No such file or directory的错误,
jps之后发现hmaster和hregionserver没有了,然后我试着再次重启hbase,重启后立刻jps是有的,但是过了几秒之后hmaster和hregionserver有没有了,
如图:
于是我只好到hbase-hadoop-master-主机名.log中查看,然后就发现了如下错误
java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMaster at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:2290) at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:233) at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:139) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:126) at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:2304) Caused by: java.net.BindException: 无法指定被请求的地址 at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:433) at sun.nio.ch.Net.bind(Net.java:425) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.apache.hadoop.hbase.ipc.RpcServer.bind(RpcServer.java:2495) at org.apache.hadoop.hbase.ipc.RpcServer$Listener.<init>(RpcServer.java:580) at org.apache.hadoop.hbase.ipc.RpcServer.<init>(RpcServer.java:1982) at org.apache.hadoop.hbase.regionserver.RSRpcServices.<init>(RSRpcServices.java:863) at org.apache.hadoop.hbase.master.MasterRpcServices.<init>(MasterRpcServices.java:210) at org.apache.hadoop.hbase.master.HMaster.createRpcServices(HMaster.java:532) at org.apache.hadoop.hbase.regionserver.HRegionServer.<init>(HRegionServer.java:532) at org.apache.hadoop.hbase.master.HMaster.<init>(HMaster.java:364) 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.hbase.master.HMaster.constructMaster(HMaster.java:2285) ... 5 more
其中无法指定被请求的地址让我想起来可能是我的ip地址已经更改了原因,于是我就进入到/etc/host,更改了ip地址后,就能正常运行了
进入命令如下:
vim /etc/hosts
然后保存,如果报错E121的话,可以输入如下命令:
:w !sudo tee % //注意要有冒号
如果不好使的话,多输入几次这个语句就可以了
小结一下吧,我觉得报错的时候,主要去看.log文件报的错,我一开始就走了弯路,一直在查找hmaster不能正常开启的原因,后来才想起来还可以在.log文件中查看,根据里面报的错去百度对应的解决办法就行了。