我已经能够通过docker-compose成功地将容器化版本的HBase主服务器和区域服务器部署到单个主机,并且现在我正尝试将其扩展到多台计算机(通过Ansible),并遇到了一个问题一直无法解决。
HBase主docker容器和区域服务器容器均无法启动,原因是由于以下形式的Cannot assign requested address错误:
019-08-23 07:18:28,065 ERROR [main] regionserver.HRegionServer: Failed construction RegionServer
java.lang.UnsupportedOperationException: Constructor threw an exception for org.apache.hadoop.hbase.ipc.NettyRpcServer
at org.apache.hadoop.hbase.util.ReflectionUtils.instantiate(ReflectionUtils.java:66)
at org.apache.hadoop.hbase.util.ReflectionUtils.instantiateWithCustomCtor(ReflectionUtils.java:45)
at org.apache.hadoop.hbase.ipc.RpcServerFactory.createRpcServer(RpcServerFactory.java:66)
at org.apache.hadoop.hbase.regionserver.RSRpcServices.createRpcServer(RSRpcServices.java:1280)
at org.apache.hadoop.hbase.regionserver.RSRpcServices.(RSRpcServices.java:1247)
at org.apache.hadoop.hbase.regionserver.RSRpcServices.(RSRpcServices.java:1203)
at org.apache.hadoop.hbase.regionserver.HRegionServer.createRpcServices(HRegionServer.java:769)
at org.apache.hadoop.hbase.regionserver.HRegionServer.(HRegionServer.java:593)
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.regionserver.HRegionServer.constructRegionServer(HRegionServer.java:3035)
at org.apache.hadoop.hbase.regionserver.HRegionServerCommandLine.start(HRegionServerCommandLine.java:63)
at org.apache.hadoop.hbase.regionserver.HRegionServerCommandLine.run(HRegionServerCommandLine.java:87)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:149)
at org.apache.hadoop.hbase.regionserver.HRegionServer.main(HRegionServer.java:3053)
Caused by: java.lang.reflect.InvocationTargetException
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.util.ReflectionUtils.instantiate(ReflectionUtils.java:58)
... 17 more
Caused by: org.apache.hbase.thirdparty.io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Cannot assign requested address
at org.apache.hbase.thirdparty.io.netty.channel.unix.Errors.newIOException(Errors.java:122)
at org.apache.hbase.thirdparty.io.netty.channel.unix.Socket.bind(Socket.java:287)
at org.apache.hbase.thirdparty.io.netty.channel.epoll.AbstractEpollChannel.doBind(AbstractEpollChannel.java:686)
at org.apache.hbase.thirdparty.io.netty.channel.epoll.EpollServerSocketChannel.doBind(EpollServerSocketChannel.java:70)
at org.apache.hbase.thirdparty.io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:563)
at org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1332)
at org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:488)
at org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:473)
at org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:984)
at org.apache.hbase.thirdparty.io.netty.channel.AbstractChannel.bind(AbstractChannel.java:259)
at org.apache.hbase.thirdparty.io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:366)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at org.apache.hbase.thirdparty.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:333)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
2019-08-23 07:18:28,067 ERROR [main] regionserver.HRegionServerCommandLine: Region server exiting
给出消息Cannot assign requested address我以为这是端口问题(不是从Docker容器中暴露一个端口,还是已经在端口上运行的东西),但是我一直无法弄清是否确实如此。 运行netstat -alp | grep netstat -alp | grep 并没有打开任何东西,我认为所有必需的端口都已暴露。
这使我相信我的部署中可能存在配置问题,这是根据我在docker-compose(在一台机器上)上的工作通过Ansible完成的。
HBase主站的相关任务(区域服务器任务看起来非常相似)是:
tasks:
- docker_service:
project_name: hbase
definition:
version: '3'
services:
hbase-master:
image: hbase-master:latest
hostname: hbase-master
environment:
HBASE_CONF_hbase_rootdir: hdfs://hostname2:9000/hbase
HBASE_CONF_hbase_cluster_distributed: 'true'
HBASE_CONF_hbase_zookeeper_quorum: "{{ zookeeper_servers }}"
HBASE_CONF_hbase_master: hostname1:16000
HBASE_CONF_hbase_master_hostname: hostname1
HBASE_CONF_hbase_master_port: 16000
HBASE_CONF_hbase_master_info_port: 16010
HBASE_CONF_hbase_regionserver_port: 16020
HBASE_CONF_hbase_regionserver_info_port: 16030
HBASE_CONF_hbase_regionserver_thrift_port: 9090
HBASE_CONF_hbase_thrift_info_port: 9091
HBASE_CONF_hbase_thrift_server_socket_read_timeout: 0
HBASE_MANAGES_ZK: 'false'
restart: always
stop_grace_period: 60s
ports:
- '16000:16000'
- '16010:16010'
基本上,区域服务器的唯一区别是HBASE_CONF_hbase_regionserver_hostname的附加环境变量。 这是根据此处的示例设计的。 我正在尝试部署一个HBase主服务器和几个区域服务器-所有这些都以相同的方式崩溃。 HBase主服务器到达尝试构建区域服务器的地步,从而导致相同的错误。
HDFS namenode(在上面的hostname2上运行)似乎工作正常,我部署的ZooKeeper实例也是如此。 我一直在努力地尝试上述方法的各种变体,但现在没有运气,并且用尽了所有的想法。