大家好,我是烤鸭:
今天分享一下使用dubbo遇到的几个问题。
1. cause: KeeperErrorCode = ConnectionLoss for /dubbo/ xxx
异常如下:
pid=9965&qos.accept.foreign.ip=false&qos.enable=true&qos.port=10887×tamp=1567416737107, cause: KeeperErrorCode = ConnectionLoss for /dubbo/com.etc.service.bank.IEtcBankcardCodeService/providers/dubbo%3A%2F%2F172.17.33.68%3A20887%2Fcom.etc.service.bank.IEtcBankcardCodeService%3Fanyhost%3Dtrue%26application%3Detc-manage-service-customer%26default.timeout%3D600000%26dubbo%3D2.6.2%26generic%3Dfalse%26interface%3Dcom.etc.service.bank.IEtcBankcardCodeService%26methods%3Dupdate%2Cinsert%2CselectListByObject%2CselectBankCodes%2CselectBank%2CselectOneByObject%26pid%3D9965%26revision%3D1.2.0%26side%3Dprovider%26timestamp%3D1567416870108at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doRegister(ZookeeperRegistry.java:116)at com.alibaba.dubbo.registry.support.FailbackRegistry.retry(FailbackRegistry.java:315)at com.alibaba.dubbo.registry.support.FailbackRegistry$1.run(FailbackRegistry.java:68)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at java.lang.Thread.run(Thread.java:748)
可以考虑看下这篇文章:
https://blog.csdn.net/xsm666/article/details/85258450
我们zk是3个节点的集群配置,修改了如下zoo.cfg的配置
tickTime=10000
initLimit=1000
2. Will not attempt to authenticate using SASL (unknown error)
[INFO] [main-SendThread(172.17.33.77:2181)] [2019-09-03 11:29:46,048] logStartConnect(1032) | Opening socket connection to server 172.17.33.77/172.17.33.77:2181. Will not attempt to authenticate using SASL (unknown error)
[WARN] [main-SendThread(172.17.33.77:2181)] [2019-09-03 11:29:46,049] run(1162) | Session 0x1034bacf7d90005 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refusedat sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
关闭防火墙。
servcie iptables stop
https://www.cnblogs.com/hfultrastrong/p/7876198.html
3. No provider available from registry:
[ERROR] [DubboServerHandler-172.17.33.68:20887-thread-68] [2019-09-04 13:39:26,308] invoke(85) | [DUBBO] Got unchecked and undeclared exception which called by 172.17.33.68. service: com.etc.service.customer.IEtcCustomerService, method: getCustomerNewType, exception: com.alibaba.dubbo.rpc.RpcException: No provider available from registry 172.17.33.68:2181 for service com.etc.service.credit.EtcCreditApplyLogService on consumer 172.17.33.68 use dubbo version 2.6.2, please check status of providers(disabled, not registered or in blacklist)., dubbo version: 2.6.2, current host: 172.17.33.68
com.alibaba.dubbo.rpc.RpcException: No provider available from registry 172.17.33.68:2181 for service com.etc.service.credit.EtcCreditApplyLogService on consumer 172.17.33.68 use dubbo version 2.6.2, please check status of providers(disabled, not registered or in blacklist).at com.alibaba.dubbo.registry.integration.RegistryDirectory.doList(RegistryDirectory.java:575)at com.alibaba.dubbo.rpc.cluster.directory.AbstractDirectory.list(AbstractDirectory.java:74)at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.list(AbstractClusterInvoker.java:271)at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:232)at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:75)at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52)at com.alibaba.dubbo.common.bytecode.proxy1.queryIsNewCustomerUrl(proxy1.java)at com.etc.service.customer.EtcCustomerServiceImpl.getCustomerNewType(EtcCustomerServiceImpl.java:873)at com.etc.service.customer.EtcCustomerServiceImpl$$FastClassBySpringCGLIB$$2f308333.invoke(<generated>)at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)at com.etc.service.customer.EtcCustomerServiceImpl$$EnhancerBySpringCGLIB$$953f1998.getCustomerNewType(<generated>)at com.alibaba.dubbo.common.bytecode.Wrapper15.invokeMethod(Wrapper15.java)at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47)at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76)at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:52)at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56)at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:62)at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:72)at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:131)at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:103)at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96)at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:172)at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:80)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at java.lang.Thread.run(Thread.java:748)
这个比较明显就是,提供者的服务找不到,看下 dubbo-admin里边,服务是否注入成功。
dubbo-admin 链接: https://pan.baidu.com/s/139VlS82K1u76lPT0Q4UjrA 提取码: ed3a
4. 项目启动后,拉取生产者时巨慢。一个项目启动半小时才能完整启动,并且访问时还获取不到生产者的服务。
notify(387) | [DUBBO] Notify urls for subscribe url provider: xxx
retry(366) | [DUBBO] Failed to retry subscribe xxx
去 dubbo-admin查看服务的生产和消费均正常,就是奇怪的地方在于一个服务同一个ip项目有多个消费者(应该只有一个)。
jps| grep 项目
发现同一个项目启动多个,这是dubbo-admin上看到多个消费者的原因。
猜想是多个服务同时启动并获取 zk上的服务,导致获取阻塞。
至于为什么同时启动多个,应该是jenkins每次集成显示成功后jar包并未启动成功,然后又集成,持续了好几次。
dubbo项目启动 zookeeper 发布和订阅特别慢。
因为zk是要往服务器写日志的,这时候检查一下服务器的io。
iostat -x
查看io读写情况。
虽然不确定是不是这个问题,切换一个机器部署zk,解决了。
新机器的io情况。
如果出现 dubbo项目启动特别慢,拉取 zookeeper 服务日志打印特别慢的情况。考虑换一台机器部署zk,有可能是服务器的io问题。