rabbitmq 使用

来源:互联网 发布:centos7网络配置 rules 编辑:程序博客网 时间:2024/04/29 06:59

RabbitMQ 是由 LShift 提供的一个 Advanced Message Queuing Protocol (AMQP) 的开源实现,由以高性能、健壮以及可伸缩性出名的 Erlang 写成,因此也是继承了这些优点。

AMQP 里主要要说两个组件:Exchange 和 Queue (在 AMQP 1.0 里还会有变动),如下图所示,绿色的 X 就是 Exchange ,红色的是 Queue ,这两者都在 Server 端,又称作 Broker ,这部分是 RabbitMQ 实现的,而蓝色的则是客户端,通常有 Producer 和 Consumer 两种类型:




pika   是 rabbitmq的 python 客户端。

http://stackoverflow.com/questions/4544744/whats-the-difference-between-celery-and-rabbitmq

Celery is a distributed task queue, which means the only thing that it should do is dispatch tasks/jobs to others servers and get the result back. But, how do servers communicate with each other, and how do they know what job they should perform? By a custom protocol? By old-databases?

Celery, by default, uses AMQP to handle that communication. If you want, you can use good-old-databases.


启动:sudo rabbitmq-server start

 sudo rabbitmqctl stop

sudo rabbitmqctl status

 sudo rabbitmqctl list_queues

--------------------------------------------------------------------

Rabbitmq is set to start automatically after it's installed. I don't think it is configured run with the service command.

To see the status of rabbitmq

sudo rabbitmqctl status

To stop the rabbitmq

sudo rabbitmqctl stop

(Try the status command again to see that it's stopped). To start it again, the recommended method is

sudo invoke-rc.d rabbitmq-server start

These all work with the vanilla ubuntu install using apt-get

Still not working?

If you've tried unsuccessfully to start or restart rabbitmq, check to see how many processes are running.

ps -ef | grep rabbit

There should be 5 processes running as the user rabbitmq. If you have more, particularly if they're running as other users (such as root, or your own user) you should stop these processes.

The cleanest way is probably to reboot your machine.



0 0
原创粉丝点击