1.netty源码解析(三十五)---Netty启动3 成功bind 等待连接
2.Hbase - kerberos认è¯å¼å¸¸
netty源码解析(三十五)---Netty启动3 成功bind 等待连接
Netty启动过程中的源码bind操作在AbstractBootstrap类中启动,由于异步特性,源码ChannelFuture在register0方法后交给事件执行器处理,源码此时isDone返回为false。源码在sync同步等待时,源码Airtest源码脚本主线程会阻塞在PendingRegistrationPromise上,源码lua绘制源码等待绑定完成。源码
PendingRegistrationPromise的源码创建和ChannelFuture的监听器是为了在绑定成功后执行后续操作。当bind0方法中的源码safeSetSuccess成功后,会触发监听器,源码进一步调用AbstractChannel的源码bind方法。这个过程会通过DefaultChannelPipeline的源码tail处理,最后在AbstractChannelHandlerContext的源码php源码定义HeadContext中,调用handler的源码bind方法,其中HeadContext的源码unsafe.bind方法会调用到NioServerSocketChannel的unsafe的dobind方法。
在NioServerSocketChannel中,真正的波段源码图绑定操作是调用原生的jdk的bind方法。当绑定成功后,AbstractChannel的dobind方法会设置promise为success,从而唤醒主线程,继续执行后续代码。cvsd解码源码至此,Netty的bind操作等待连接的到来。
总结整个流程:Bootstrap创建Promise等待,然后通过管道传递到AbstractChannel,通过HeadContext调用unsafe.bind,最终在NioServerSocketChannel中调用原生bind,主线程等待并处理bind结果。当连接到来时,整个绑定过程结束。
Hbase - kerberos认è¯å¼å¸¸
> ä¹åæä¹è®¤è¯é½è®¤è¯ä¸ä¸ï¼é®é¢æ¾äºå¥½äºï¼åç°å®çå¼å¸¸è·å®é æä½æ ¹æ¬å°±å¯¹ä¸ä¸ï¼æ»é©¬å½æ´»é©¬å»ï¼å½æ¶ä¹æ¯çæ¹æ好çï¼ç»å¤§å®¶ä¼è®°å½è®°å½ã
```
KrbException: Server not found in Kerberos database (7) - LOOKING_UP_SERVER
>>> KdcAccessibility: remove storm1.starsriver.cn
at sun.security.krb5.KrbTgsRep.<init>(KrbTgsRep.java:)
>>> KDCRep: init() encoding tag is req type is
at sun.security.krb5.KrbTgsReq.getReply(KrbTgsReq.java:)
>>>KRBError:
at sun.security.krb5.KrbTgsReq.sendAndGetCreds(KrbTgsReq.java:)
cTime is Fri Aug :: CST
sTime is Tue Jul :: CST
at sun.security.krb5.internal.CredentialsUtil.serviceCreds(CredentialsUtil.java:)
suSec is
error code is 7
at sun.security.krb5.internal.CredentialsUtil.acquireServiceCreds(CredentialsUtil.java:)
error Message is Server not found in Kerberos database
at sun.security.krb5.Credentials.acquireServiceCreds(Credentials.java:)
cname is hbase/lake.dounine.com@dounine.com
at sun.security.jgss.krb5.Krb5Context.initSecContext(Krb5Context.java:)
sname is hbase/...@dounine.com
msgType is
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:)
at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5Client.java:)
at org.apache.hadoop.hbase.security.AbstractHBaseSaslRpcClient.getInitialResponse(AbstractHBaseSaslRpcClient.java:)
at org.apache.hadoop.hbase.security.NettyHBaseSaslRpcClientHandler$1.run(NettyHBaseSaslRpcClientHandler.java:)
at org.apache.hadoop.hbase.security.NettyHBaseSaslRpcClientHandler$1.run(NettyHBaseSaslRpcClientHandler.java:)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:)
at org.apache.hadoop.hbase.security.NettyHBaseSaslRpcClientHandler.handlerAdded(NettyHBaseSaslRpcClientHandler.java:)
at org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:)
at org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPipeline.addFirst(DefaultChannelPipeline.java:)
at org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPipeline.addFirst(DefaultChannelPipeline.java:)
at org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPipeline.addFirst(DefaultChannelPipeline.java:)
at org.apache.hadoop.hbase.ipc.NettyRpcConnection.saslNegotiate(NettyRpcConnection.java:)
at org.apache.hadoop.hbase.ipc.NettyRpcConnection.access$(NettyRpcConnection.java:)
at org.apache.hadoop.hbase.ipc.NettyRpcConnection$3.operationComplete(NettyRpcConnection.java:)
at org.apache.hadoop.hbase.ipc.NettyRpcConnection$3.operationComplete(NettyRpcConnection.java:)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:)
at org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:)
at org.apache.hbase.thirdparty.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:)
at org.apache.hbase.thirdparty.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:)
at org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:)
at org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:)
at org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:)
at org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:)
at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:)
at java.lang.Thread.run(Thread.java:)
Caused by: KrbException: Identifier doesn't match expected value ()
at sun.security.krb5.internal.KDCRep.init(KDCRep.java:)
at sun.security.krb5.internal.TGSRep.init(TGSRep.java:)
at sun.security.krb5.internal.TGSRep.<init>(TGSRep.java:)
at sun.security.krb5.KrbTgsRep.<init>(KrbTgsRep.java:)
... more
```
æ¤é误éè¦å°çº¿ä¸æå¡å¨çååæ å°æ¾å ¥Clientä¸ç`/etc/hosts`
```
..0.2 h1.demo.com
..0.3 h2.demo.com
..0.4 h3.demo.com
```
---
![](https://upload-images.jianshu.io/upload_images/-bb8dadcd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/)