2014-09-12 54 views
2

我試圖讓在Rackspace公司Ubuntu的機器上運行我的芹菜程序,但是我在使用RabbitMQ的連接芹菜麻煩。在我的Mac上,使用默認的rabbitmq設置(BROKER_URL ='amqp://'),一切正常,但在生產服務器上,我無法讓芹菜與rabbitmq進行通話。芹菜不能連接到RabbitMQ的 - 意外的方法來接收

這裏就是我所做的:

$ sudo rabbitmqctl add_user celeryuser celerypassword 
$ sudo rabbitmqctl add_vhost celeryhost 
$ sudo rabbitmqctl set_permissions -p celeryhost celeryuser ".*" ".*" ".*" 

here

以下幾個方向在celeryconfig.py我與配置從上面

BROKER_URL = 'amqp://celeryuser:[email protected]:5672/celeryhost' 

定義的經紀人URL和celery_app.py我加載以上配置:

app.config_from_object('proj.celeryconfig') 

但是當我嘗試先從芹菜工人:

celery worker --app=proj.celery_app 

我收到以下錯誤:

-------------- [email protected] v3.1.13 (Cipater) 
---- **** ----- 
--- * *** * -- Linux-2.6.32-64-server-x86_64-with-Ubuntu-10.04-lucid 
-- * - **** --- 
- ** ---------- [config] 
- ** ---------- .> app:   proj:0x29e9850 
- ** ---------- .> transport: amqp://celeryuser:**@localhost:5672/celeryhost 
- ** ---------- .> results:  amqp 
- *** --- * --- .> concurrency: 4 (prefork) 
-- ******* ---- 
--- ***** ----- [queues] 
-------------- .> celery   exchange=celery(direct) key=celery 


[2014-09-12 09:28:00,266: ERROR/MainProcess] consumer: Cannot connect to amqp://celeryuser:**@localhost:5672/celeryhost: Couldn't log in: unexpected method received. 
Trying again in 2.00 seconds... 

我檢查,看看是否RabbitMQ的服務器與運行:

$ sudo rabbitmqctl status 

並且結果是:

Status of node [email protected] ... 
[{running_applications,[{rabbit,"RabbitMQ","1.7.2"}, 
         {mnesia,"MNESIA CXC 138 12","4.4.12"}, 
         {os_mon,"CPO CXC 138 46","2.2.4"}, 
         {sasl,"SASL CXC 138 11","2.1.8"}, 
         {stdlib,"ERTS CXC 138 10","1.16.4"}, 
         {kernel,"ERTS CXC 138 10","2.13.4"}]}, 
{nodes,[[email protected]]}, 
{running_nodes,[[email protected]]}] 
...done. 

回答

1

發生這種情況是因爲Ubuntu服務器安裝了一個老版本的rabbitmq,然後在我的開發機器上安裝了它。

,因爲我意識到,當我看着RabbitMQ的工人的地位..版本說明:

{rabbit,"RabbitMQ","1.7.2"}, 

,但在我的地方我有

{rabbit,"RabbitMQ","3.3.4"}, 

我更新了RabbitMQ的版本服務器在Ubuntu上,並設置相同的權限,如上所述,使用this後作爲指導

現在我能夠成功地啓動生產mac上的芹菜工人海因。