System.setProperty("java.security.krb5.conf", 
config.getJSONObject("auth").getString("krb5"))

val conf = HBaseConfiguration.create()
val zookeeper = config.getString("zookeeper")
val port = config.getString("port")
conf.set(HConstants.ZOOKEEPER_QUORUM, zookeeper)
conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, port)
conf.set("hadoop.security.authentication", "Kerberos")
conf.set(HConstants.ZK_CLIENT_KEYTAB_FILE,config.getJSONObject("auth").getString("keytab"))
conf.set(HConstants.ZK_CLIENT_KERBEROS_PRINCIPAL,config.getJSONObject("auth").getString("principal"))
conf.set(HConstants.ZK_SERVER_KEYTAB_FILE,config.getJSONObject("auth").getString("keytab"))
conf.set(HConstants.ZK_SERVER_KERBEROS_PRINCIPAL,config.getJSONObject("auth").getString("principal"))

HBaseAdmin.available(conf)

I get a error

21/08/18 12:03:18 INFO ZooKeeper: Initiating client connection, 
connectString=bigdser5:2181,bigdser2:2181,bigdser3:2181 sessionTimeout=90000 
watcher=org.apache.hadoop.hbase.zookeeper.ReadOnlyZKClient$$Lambda$16/828536028@17ea11aa
21/08/18 12:03:18 INFO ClientCnxn: Opening socket connection to server 
bigdser5/10.3.87.27:2181. Will not attempt to authenticate using SASL (unknown 
error)
21/08/18 12:03:18 INFO ClientCnxn: Socket connection established, initiating 
session, client: /10.2.65.14:5908, server: bigdser5/10.3.87.27:2181
21/08/18 12:03:18 INFO ClientCnxn: Session establishment complete on server 
bigdser5/10.3.87.27:2181, sessionid = 0x37acbbd0723c7cd, negotiated timeout = 
60000
Exception in thread "main" org.apache.hadoop.hbase.MasterNotRunningException: 
org.apache.hadoop.hbase.MasterNotRunningException: java.io.IOException: Call to 
bigdser2/10.3.87.24:16000 failed on local exception: java.io.IOException: 
你的主机中的软件中止了一个已建立的连接。
at 
org.apache.hadoop.hbase.client.ConnectionImplementation.isMasterRunning(ConnectionImplementation.java:585)
at org.apache.hadoop.hbase.client.HBaseAdmin.available(HBaseAdmin.java:2366)
at com.join.hbase.reader.HbaseReader.readFrom(HbaseReader.scala:36)
at com.join.Synctool$.main(Synctool.scala:524)
at com.join.Synctool.main(Synctool.scala)
Caused by: org.apache.hadoop.hbase.MasterNotRunningException: 
java.io.IOException: Call to bigdser2/10.3.87.24:16000 failed on local 
exception: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
at 
org.apache.hadoop.hbase.client.ConnectionImplementation$MasterServiceStubMaker.makeStub(ConnectionImplementation.java:1175)
at 
org.apache.hadoop.hbase.client.ConnectionImplementation.getKeepAliveMasterService(ConnectionImplementation.java:1234)
at 
org.apache.hadoop.hbase.client.ConnectionImplementation.isMasterRunning(ConnectionImplementation.java:583)
... 4 more
Caused by: java.io.IOException: Call to bigdser2/10.3.87.24:16000 failed on 
local exception: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
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.ipc.IPCUtil.wrapException(IPCUtil.java:221)
at 
org.apache.hadoop.hbase.ipc.AbstractRpcClient.onCallFinished(AbstractRpcClient.java:390)
at 
org.apache.hadoop.hbase.ipc.AbstractRpcClient.access$100(AbstractRpcClient.java:95)
at 
org.apache.hadoop.hbase.ipc.AbstractRpcClient$3.run(AbstractRpcClient.java:410)
at 
org.apache.hadoop.hbase.ipc.AbstractRpcClient$3.run(AbstractRpcClient.java:406)
at org.apache.hadoop.hbase.ipc.Call.callComplete(Call.java:103)
at org.apache.hadoop.hbase.ipc.Call.setException(Call.java:118)
at 
org.apache.hadoop.hbase.ipc.NettyRpcConnection$4.operationComplete(NettyRpcConnection.java:292)
at 
org.apache.hadoop.hbase.ipc.NettyRpcConnection$4.operationComplete(NettyRpcConnection.java:284)
at 
org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:502)
at 
org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:476)
at 
org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:415)
at 
org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:152)
at 
org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:95)
at 
org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:30)
at 
org.apache.hadoop.hbase.ipc.NettyRpcConnection.write(NettyRpcConnection.java:284)
at 
org.apache.hadoop.hbase.ipc.NettyRpcConnection.access$1100(NettyRpcConnection.java:71)
at 
org.apache.hadoop.hbase.ipc.NettyRpcConnection$6$1.run(NettyRpcConnection.java:344)
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.nio.NioEventLoop.run(NioEventLoop.java:495)
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)
Caused by: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:51)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:469)
at 
org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.java:405)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:939)
at 
org.apache.hbase.thirdparty.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:360)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:906)
at 
org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.java:1370)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:739)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:731)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:717)
at 
org.apache.hbase.thirdparty.io.netty.channel.ChannelDuplexHandler.flush(ChannelDuplexHandler.java:117)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:739)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:731)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:717)
at 
org.apache.hbase.thirdparty.io.netty.channel.ChannelDuplexHandler.flush(ChannelDuplexHandler.java:117)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:739)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:754)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:778)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:747)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:801)
at 
org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1036)
at 
org.apache.hbase.thirdparty.io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:305)
... 9 more


igyu

Reply via email to