RabbitMQ Shovel无法启动

时间:2012-06-27 00:46:39

标签: linux rabbitmq

我有一对运行带有rabbitmq消息队列的arch linux的计算机,我想使用铲子将消息从第一台计算机上的队列移动到第二台计算机上的队列。不幸的是,我似乎无法创建一个铲子,甚至验证我的rabbitmq.config文件正在被读取。

计算机1的IP地址为192.168.6.66

/etc/rabbitmq/rabbitmq-env.conf

NODENAME=bunny
NODE_IP_ADDRESS=192.168.6.66
NODE_PORT=5672

LOG_BASE=/var/log/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia
RABBITMQ_PLUGINS_DIR=/usr/lib/rabbitmq/lib/rabbitmq_server-2.7.1/plugins

/etc/rabbitmq/rabbitmq.conf

[   {mnesia, [{dump_log_write_threshold, 100}]},
    {bunny, [{vm_memory_high_watermark, 0.3}]},
    {rabbitmq_shovel,
        [{shovels,
            [{test_shovel,
                [{sources, [{broker, "amqp://shoveluser:shoveluser@192.168.6.64:5672/"}]},
                 {destinations, [{broker, ""}]},
                 {queue, <<"observation2">>}
                ]
            }]

        }]
    }
].

计算机2的IP地址为192.168.6.64

/etc/rabbitmq/rabbitmq-env.conf

NODENAME=bunny
NODE_IP_ADDRESS=0.0.0.0
NODE_PORT=5672

LOG_BASE=/var/log/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia
RABBITMQ_PLUGINS_DIR=/usr/lib/rabbitmq/lib/rabbitmq_server-2.7.1/plugins

当我在计算机1上重启rabbitmq-server时,这是输出:

[root@test_toshiba ~]# /etc/rc.d/rabbitmq-server restart
:: Stopping rabbitmq-server daemon                                                                                                                            [BUSY] Stopping and halting node bunny@localhost ...
...done.
                                                                                                                                                              [DONE]
:: Starting rabbitmq-server daemon                                                                                                                            [BUSY] Activating RabbitMQ plugins ...

********************************************************************************
********************************************************************************

9 plugins activated:
* amqp_client-2.7.1
* erlando-2.7.1
* mochiweb-1.3-rmq2.7.1-git
* rabbitmq_management-2.7.1
* rabbitmq_management_agent-2.7.1
* rabbitmq_mochiweb-2.7.1
* rabbitmq_shovel-2.7.1
* rabbitmq_shovel_management-2.7.1
* webmachine-1.7.0-rmq2.7.1-hg

鉴于配置文件文档here

的描述,我希望看到这个“配置文件:/etc/rabbitmq/rabbitmq.config”

在rabbitmq-server启动后,我运行此命令,看不到铲子:

[root@test_toshiba ~]# rabbitmqctl eval 'rabbit_shovel_status:status().'
[]
...done.

这是rabbitmq状态

[root@test_toshiba ~]# rabbitmqctl status
Status of node bunny@localhost ...
[{pid,14225},
 {running_applications,
     [{rabbitmq_shovel,"Data Shovel for RabbitMQ","2.7.1"},
      {erlando,"Syntax extensions for Erlang","2.7.1"},
      {rabbitmq_shovel_management,"Shovel Status","2.7.1"},
      {rabbitmq_management,"RabbitMQ Management Console","2.7.1"},
      {rabbitmq_management_agent,"RabbitMQ Management Agent","2.7.1"},
      {amqp_client,"RabbitMQ AMQP Client","2.7.1"},
      {rabbit,"RabbitMQ","2.7.1"},
      {os_mon,"CPO  CXC 138 46","2.2.9"},
      {sasl,"SASL  CXC 138 11","2.2.1"},
      {rabbitmq_mochiweb,"RabbitMQ Mochiweb Embedding","2.7.1"},
      {webmachine,"webmachine","1.7.0-rmq2.7.1-hg"},
      {mochiweb,"MochiMedia Web Server","1.3-rmq2.7.1-git"},
      {inets,"INETS  CXC 138 49","5.9"},
      {mnesia,"MNESIA  CXC 138 12","4.7"},
      {stdlib,"ERTS  CXC 138 10","1.18.1"},
      {kernel,"ERTS  CXC 138 10","2.15.1"}]},
 {os,{unix,linux}},
 {erlang_version,
     "Erlang R15B01 (erts-5.9.1) [source] [smp:4:4] [async-threads:30] [hipe] [kernel-poll:true]\n"},
 {memory,
     [{total,18530752},
      {processes,6813815},
      {processes_used,6813800},
      {system,11716937},
      {atom,428361},
      {atom_used,414658},
      {binary,182176},
      {code,8197217},
      {ets,911776}]},
 {vm_memory_high_watermark,0.39999999942574066},
 {vm_memory_limit,417929625}]
...done.

/ var / log / rabbitmq中的日志中没有任何错误消息。

如何验证我的配置文件是否正在使用,为什么我的铲子不会启动?

2 个答案:

答案 0 :(得分:2)

您需要为铲子定义目的地。


    [   {mnesia, [{dump_log_write_threshold, 100}]},
        {bunny, [{vm_memory_high_watermark, 0.3}]},
        {rabbitmq_shovel,
            [{shovels,
                [{test_shovel,
                    [{sources, [{broker, "amqp://shoveluser:shoveluser@192.168.6.64:5672/"}]},
                     {destinations, [{broker, "amqp://shoveluser:shoveluser@192.168.6.66:5672/"}]},
                     {queue, >}
                    ]
                }]

            }]
        }
    ].

答案 1 :(得分:0)

我认为“”不足以指定localhost代理(在“目标”中)。我认为需要“amqp://”。

因此,您的目的地术语应为:

{destinations,[{broker,“amqp://”}]}

指定本地经纪人的用户名和主机名(另一个答案)也可能有效,但我不认为这是必要的。