Mule群集部署问题

时间:2016-10-24 06:27:54

标签: mule mule-cluster

我正在尝试在Mulesoft中实现群集。我的目的是将应用程序部署到应用程序服务器集群。  我已经在两个物理机器中安装了一个Mule服务器,我将它绑定到一个集群。  然后我创建了一个Mule应用程序,它监听HTTP端点以触发邮件。  我在通过MMC将应用程序部署到创建的Mule集群时遇到了问题。

Click to see the cluster of servers      应用程序将部署到群集中的一个服务器,并且在部署到另一个服务器时存在问题。 我得到的错误是:

   *ERROR 2016-10-21 21:52:09,283 [qtp1451192493-104]         org.mule.module.launcher.DefaultArchiveDeployer: 

org.mule.module.launcher.DeploymentStartException:     BindException: Address already in use: bind
    at    org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:156) ~[?:?]
    at org.mule.module.launcher.artifact.ArtifactWrapper$4.execute(ArtifactWrapper.java:98) ~[?:?]
    at org.mule.module.launcher.artifact.ArtifactWrapper.executeWithinArtifactClassLoader(ArtifactWrapper.java:129) ~[?:?]
    at org.mule.module.launcher.artifact.ArtifactWrapper.start(ArtifactWrapper.java:93) ~[?:?]
    at org.mule.module.launcher.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:26) ~[?:?]
    at org.mule.module.launcher.DefaultArchiveDeployer.guardedDeploy(DefaultArchiveDeployer.java:310) ~[?:?]
    at org.mule.module.launcher.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:330) ~[?:?]
    at org.mule.module.launcher.DefaultArchiveDeployer.deployPackagedArtifact(DefaultArchiveDeployer.java:155) ~[?:?]
    at org.mule.module.launcher.MuleDeploymentService.deploy(MuleDeploymentService.java:192) ~[?:?]
    at com.mulesoft.mmc.agent.service.impl.ApplicationServiceImpl.deploy(ApplicationServiceImpl.java:302) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[?:?]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) ~[?:?]
    at com.sun.proxy.$Proxy45.deploy(Unknown Source) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
    at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:212) ~[?:?]
    at com.mulesoft.common.remoting.RemoteInvocationDecorator.invoke(RemoteInvocationDecorator.java:107) ~[?:?]
    at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:39) ~[?:?]
    at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78) ~[?:?]
    at com.mulesoft.common.remoting.StreamSupportingHttpInvokerServiceExporter.invokeAndCreateResult(StreamSupportingHttpInvokerServiceExporter.java:122) ~[?:?]
    at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:74) ~[?:?]
    at com.mulesoft.mmc.agent.remoting.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:50) ~[?:?]
    at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51) ~[?:?]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) ~[?:?]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) ~[?:?]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) ~[?:?]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) ~[?:?]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595) ~[?:?]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) ~[?:?]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:696) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1515) ~[?:?]
    at com.mulesoft.mmc.agent.web.ConsoleClientCertFilter.doFilter(ConsoleClientCertFilter.java:138) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1495) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:519) ~[?:?]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:138) ~[?:?]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:564) ~[?:?]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:213) ~[?:?]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1097) ~[?:?]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:448) ~[?:?]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175) ~[?:?]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1031) ~[?:?]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136) ~[?:?]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) ~[?:?]
    at org.eclipse.jetty.server.Server.handle(Server.java:446) ~[?:?]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:271) ~[?:?]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:246) ~[?:?]
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358) ~[?:?]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601) ~[?:?]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532) ~[?:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]
Caused by: org.mule.api.lifecycle.LifecycleException: Failed to invoke lifecycle phase "start" on object: org.mule.module.http.internal.listener.DefaultHttpListenerConfig@30206033
    at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:248) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.doApplyLifecycle(RegistryLifecycleCallback.java:91) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.onTransition(RegistryLifecycleCallback.java:67) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:140) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:111) ~[?:?]
    at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:88) ~[?:?]
    at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:141) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:91) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:87) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:69) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) ~[?:?]
    at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:294) ~[?:?]
    at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:134) ~[?:?]
    ... 56 more
Caused by: org.mule.api.DefaultMuleException: Address already in use: bind (java.net.BindException)
    at org.mule.module.http.internal.listener.DefaultHttpListenerConfig.start(DefaultHttpListenerConfig.java:275) ~[?:?]
    at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
    at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:237) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.doApplyLifecycle(RegistryLifecycleCallback.java:91) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.onTransition(RegistryLifecycleCallback.java:67) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:140) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:111) ~[?:?]
    at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:88) ~[?:?]
    at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:141) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:91) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:87) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:69) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) ~[?:?]
    at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:294) ~[?:?]
    at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:134) ~[?:?]
    ... 56 more
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_77]
    at sun.nio.ch.Net.bind(Unknown Source) ~[?:1.8.0_77]
    at sun.nio.ch.Net.bind(Unknown Source) ~[?:1.8.0_77]
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source) ~[?:1.8.0_77]
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source) ~[?:1.8.0_77]
    at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bindToChannelAndAddress(TCPNIOBindingHandler.java:131) ~[?:?]
    at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:88) ~[?:?]
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:248) ~[?:?]
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:228) ~[?:?]
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:219) ~[?:?]
    at org.mule.module.http.internal.listener.grizzly.GrizzlyServer.start(GrizzlyServer.java:41) ~[?:?]
    at org.mule.module.http.internal.listener.DefaultHttpListenerConfig.start(DefaultHttpListenerConfig.java:271) ~[?:?]
    at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77]
    at org.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:237) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.doApplyLifecycle(RegistryLifecycleCallback.java:91) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleCallback.onTransition(RegistryLifecycleCallback.java:67) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:140) ~[?:?]
    at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:111) ~[?:?]
    at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:88) ~[?:?]
    at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:141) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:91) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:87) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:69) ~[?:?]
    at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) ~[?:?]
    at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:294) ~[?:?]
    at org.mule.module.launcher.application.DefaultMuleApplication.start(DefaultMuleApplication.java:134) ~[?:?]
    ... 56 more

是否要对群集部署进行任何特定的配置更改? 有人请帮帮我。

此外,欢迎与BAM相关的建议

4 个答案:

答案 0 :(得分:1)

正如日志所示,您的HTTP侦听器正在尝试使用已使用的端口

  

引起:java.net.BindException:已在使用的地址:bind

使用操作系统工具找出正在使用该端口的进程。

答案 1 :(得分:1)

当您通过Mule管理控制台部署应用程序以构建群集时。您应该将HTTP入站端点的应用程序端点公开为“localhost:portnumber”。在您的方案中,因为两台服务器都位于同一设备中。

单台机器中的两个服务器实例

serverA 的端点将被描述为 machineAIP:8080 ,而 serverB 也将被描述为 machineIPA:8080 。这就出现了绑定异常

两台不同机器中的两台服务器实例

serverA 的端点将被描述为 machineAIP:8080 ,而 serverB 也将被描述为 machineIPB:8080 。这是在机器IP的帮助下区分的。

因此,与两个不同的服务器一起使用总是好的。如果您使用相同的机器创建两个mule服务器实例将导致与暴露相同端点相关的问题。我们需要使用两台不同的机器来增强高可用性。它还可以确保机器崩溃不会影响群集服务器的运行。

使用两台不同的计算机部署应用程序(每台计算机都有一台mule服务器实例),并且您在入站端点中指定的端口号未被使用。

如果我的回答能为您提供解决方案。快乐的编码:)

答案 2 :(得分:0)

基于异常 -

引起:java.net.BindException:已在使用的地址:bind

这可能是因为两个原因 -

  1. 通过HTTP连接器用于mule应用程序的端口已经在服务器级别使用 - 因此尝试更改端口并确保端口未使用。

  2. 如果要在群集环境中使用MMC部署mule应用程序,则必须使用localhost OR 0.0.0.0端口配置HTTP连接器,以便在服务器/节点中部署时使用localhost引用在集群下。

  3. 注意,当您使用localhost OR 0.0.0.0时,应用程序将部署在节点中,您的负载均衡器将指向节点地址(主机dns),然后它将使用您的端口重新调用两个节点的调用在http连接器中提到。

    如果能解决问题,请尝试告诉我。

答案 3 :(得分:0)

参考我的另一个答案 - 将此作为参考

<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8080" doc:name="HTTP Listener Configuration"/> 

<flow name="sample-http-appFlow"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="flow1" doc:name="HTTP"/> 
    <logger message="Payload is #[message.payload]" level="INFO" doc:name="Logger"/> 
</flow> 
<flow name="sample-http-appFlow1"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="flow2" doc:name="HTTP"/> 
    <logger message="Payload is #[message.payload]" level="INFO" doc:name="Logger"/> 
</flow>