运行在同一台机器上

运行在同一台机器上

本文介绍了RabbitMQ 和 ActiveMQ 运行在同一台机器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于测试目的,我需要在同一台 Windows 机器上运行 ActiveMQ 和 RabbitMQ.我都安装了,但我不能同时运行它们:我需要停止一项服务才能运行另一项服务.

这是我在运行 ActiveMQ 的情况下尝试启动 RabbitMQ 时遇到的错误:

=信息报告==== 2015 年 2 月 17 日::14:24:00 ===错误描述:{不能开始,兔子,{坏_返回,{{兔子,开始,[正常,[]]},{'出口',{兔子,failure_during_boot,{引导步骤,网络,{case_clause,{错误,{{关掉,{failed_to_start_child,tcp_listener,{cannot_listen,{0,0,0,0,0,0,0,0},5672,eacces}}},{孩子,未定义,'rabbit_tcp_listener_sup_::5672',{tcp_listener_sup,start_link,[{0,0,0,0,0,0,0,0},5672,[inet6,二进制,{数据包,原始},{reuseaddr,true},{积压,128},{节点,真},{linger,{true,0}},{exit_on_close,false}],{rabbit_networking,tcp_listener_started,[amqp]},{rabbit_networking,tcp_listener_stopped,[amqp]},{rabbit_networking,start_client,[]},"TCP 侦听器"]},瞬态,无限,主管,[tcp_listener_sup]}}}}}}}}}}

这是我在 RabbitMQ 已经运行的情况下尝试启动 ActiveMQ 时遇到的错误:

jvm 1 |信息 |在以下位置侦听连接:tcp://BROKER:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600虚拟机 1 |信息 |连接器 openwire 开始虚拟机 1 |错误 |无法启动 Apache ActiveMQ ([localhost, ID:DEV-BROKER01-56290-1424197666199-0:1], java.io.IOException: Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server套接字:amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 由于:java.net.BindException:地址已在使用:JVM_Bind)虚拟机 1 |信息 |Apache ActiveMQ 5.11.0(本地主机,ID:DEV-BROKER01-56290-1424197666199-0:1)正在关闭

地址已在使用中"是我猜的关键.

有什么办法可以解决这个问题?谢谢

解决方案

这是问题所在:java.net.BindException: 地址已被使用:JVM_Bind)

两个代理都使用 5672 端口(amqp 默认端口).

只需更改一个代理的端口,例如在rabbitmq 中检查此链接:https://www.rabbitmq.com/configure.html

配置文件rabbitmq.config允许RabbitMQ核心要配置的应用程序、Erlang 服务和 RabbitMQ 插件.它是一个标准的 Erlang 配置文件,记录在 Erlang配置手册页.

示例配置文件如下:

[{兔子,[{tcp_listeners,[5673]}]}].

此示例将 RabbitMQ 侦听的端口从 5672 到 5673.

这个配置文件和rabbitmq-env.conf不一样,它可用于在非windows系统上设置环境变量.

For testing purposes I need ActiveMQ and RabbitMQ running on the same Windows machine. I have both installed, but I can't run them together: I need to stop one service in order to have the other one running.

This is the error I get trying to start RabbitMQ having ActiveMQ running:

=INFO REPORT==== 17-Feb-2015::14:24:00 ===
Error description:
   {could_not_start,rabbit,
    {bad_return,
     {{rabbit,start,[normal,[]]},
      {'EXIT',
       {rabbit,failure_during_boot,
        {boot_step,networking,
         {case_clause,
          {error,
           {{shutdown,
             {failed_to_start_child,tcp_listener,
              {cannot_listen,{0,0,0,0,0,0,0,0},5672,eacces}}},
            {child,undefined,'rabbit_tcp_listener_sup_:::5672',
             {tcp_listener_sup,start_link,
              [{0,0,0,0,0,0,0,0},
               5672,
               [inet6,binary,
                {packet,raw},
                {reuseaddr,true},
                {backlog,128},
                {nodelay,true},
                {linger,{true,0}},
                {exit_on_close,false}],
               {rabbit_networking,tcp_listener_started,[amqp]},
               {rabbit_networking,tcp_listener_stopped,[amqp]},
               {rabbit_networking,start_client,[]},
               "TCP Listener"]},
             transient,infinity,supervisor,
             [tcp_listener_sup]}}}}}}}}}}

And this is the error I get trying to start ActiveMQ with RabbitMQ already running:

jvm 1    |  INFO | Listening for connections at: tcp://BROKER:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600
jvm 1    |  INFO | Connector openwire started
jvm 1    | ERROR | Failed to start Apache ActiveMQ ([localhost, ID:DEV-BROKER01-56290-1424197666199-0:1], java.io.IOException: Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server socket: amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 due to:
                   java.net.BindException: Address already in use: JVM_Bind)
jvm 1    |  INFO | Apache ActiveMQ 5.11.0 (localhost, ID:DEV-BROKER01-56290-1424197666199-0:1) is shutting down

That "Address already in use" is the key I guess.

Any way to sort this out? Thanks

解决方案

this is the problem: java.net.BindException: Address already in use: JVM_Bind)

both the brokers use the 5672 port (amqp default port).

just change the port for one broker, for example in rabbitmq check this link:https://www.rabbitmq.com/configure.html

[

     {rabbit, [{tcp_listeners, [5673]}]}
].

这篇关于RabbitMQ 和 ActiveMQ 运行在同一台机器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 01:43