alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.29k stars 12.84k forks source link

集群部署后服务注册报错,选举leader #515

Closed RoderickAdriance closed 5 years ago

RoderickAdriance commented 5 years ago

服务端日志: image

客户端日期: java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/instance after all servers([hadoop:8848, hadoop02:8848, hadoop03:8848]) tried at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:335) ~[nacos-client-0.6.2.jar:na] at com.alibaba.nacos.client.naming.net.NamingProxy.reqAPI(NamingProxy.java:267) ~[nacos-client-0.6.2.jar:na] at com.alibaba.nacos.client.naming.net.NamingProxy.registerService(NamingProxy.java:167) ~[nacos-client-0.6.2.jar:na]

nkorange commented 5 years ago

这是Nacos服务端启动时报错,还是运行时报错?Nacos服务端启动的时候需要选举leader,这期间不可写

RoderickAdriance commented 5 years ago

运行报错

RoderickAdriance commented 5 years ago

客户端注册的时候报的错,我是用springcloud自动注册的 配置文件: image

服务端报错日志 2018-12-24 18:05:30,286 ERROR Servlet.service() for servlet [dispatcherServlet] ted exception is java.lang.IllegalStateException: No leader at present] with roo

java.lang.IllegalStateException: No leader at present at com.alibaba.nacos.naming.raft.RaftProxy.proxyPostLarge(RaftProxy.java at com.alibaba.nacos.naming.raft.RaftCore.doSignalPublish(RaftCore.java: at com.alibaba.nacos.naming.core.DomainsManager.easyAddOrReplaceDom(Doma at com.alibaba.nacos.naming.web.ApiCommands.addOrReplaceDom(ApiCommands. at com.alibaba.nacos.naming.web.ApiCommands.regDom(ApiCommands.java:270) at com.alibaba.nacos.naming.web.ApiCommands.clientBeat(ApiCommands.java: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvok at org.springframework.web.method.support.InvocableHandlerMethod.invokeF at org.springframework.web.servlet.mvc.method.annotation.ServletInvocabl at org.springframework.web.servlet.mvc.method.annotation.RequestMappingH at org.springframework.web.servlet.mvc.method.annotation.RequestMappingH at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapt at org.springframework.web.servlet.DispatcherServlet.doDispatch(Dispatch at org.springframework.web.servlet.DispatcherServlet.doService(Dispatche at org.springframework.web.servlet.FrameworkServlet.processRequest(Frame at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServl at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkSer at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF at com.alibaba.nacos.config.server.filter.NacosWebFilter.doFilter(NacosW at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF at com.alibaba.nacos.naming.web.DistroFilter.doFilter(DistroFilter.java: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF at org.springframework.web.filter.RequestContextFilter.doFilterInternal( at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInter at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInterna at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF at org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLig at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(Abstract at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpo at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBas at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskTh at java.lang.Thread.run(Thread.java:748)

nkorange commented 5 years ago

cluster.conf文件内容是怎么配置的?然后看下{nacos.home}/logs/naming-raft.log有没有报错

xuechaos commented 5 years ago

@RoderickAdriance 请稍微在补充一下信息?

nkorange commented 5 years ago

Reopen this issue if you have more information provided.