rabbitmq, windows/linux, c/c++/node.js/golang/dotnet
Posted 拥剑公子的博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rabbitmq, windows/linux, c/c++/node.js/golang/dotnet相关的知识,希望对你有一定的参考价值。
官网:http://www.rabbitmq.com/
zeromq 相当于 message backbone,而rabbitmq相当于message broker。有的应用系统中,二者并存。
(1)windows安装
windows下载:rabbitmq-server-3.6.6.exe,需要先安装erlang
然后:
cd C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.6\sbin
rabbitmq-plugins.bat enable rabbitmq_management
rabbitmqctl.bat list_users
rabbitmqctl.bat add_user root 123456
rabbitmqctl.bat list_users
rabbitmqctl.bat set_user_tags root administrator
rabbitmqctl.bat change_password guest 123456
rabbitmqctl.bat status
web访问:http://localhost:15672
(2)linux安装
sudo apt-get install erlang-nox esl-erlang socat erlang
sudo dpkg -i rabbitmq-server_3.6.6-1_all.deb
常用指令:
invoke-rc.d rabbitmq-server stop
invoke-rc.d rabbitmq-server start
rabbitmqctl status
rabbitmq-plugins enable rabbitmq_management
rabbitmqctl list_users
rabbitmqctl add_user root 123456
rabbitmqctl set_user_tags root administrator
rabbitmqctl change_password guest 123456
rabbitmqctl list_users
rabbitmqctl status
rabbitmqctl set_permissions -p / root ‘.*‘ ‘.*‘ ‘.*‘
更改web端口,参考:/usr/share/doc/rabbitmq-server/rabbitmq.config.example
拷贝到/etc/rabbitmq/rabbitmq.config,这是erlang语法,修改内容如下:
[
{rabbitmq_management, [{listener, [{port, 12345}]}]},
{rabbit, [{tcp_listeners, [12346]}]}
].
这是修改web控制台端口为12345和数据服务端口为12346,重启服务
(3)各种编程语言sdk和例程:
http://www.rabbitmq.com/devtools.html
http://www.rabbitmq.com/getstarted.html
(4)c/c++接口例程
c语言接口:https://github.com/alanxz/rabbitmq-c
mkdir build
cd build/
cmake ..
sudo cmake --build . --target install
参考:http://blog.csdn.net/yasi_xi/article/details/8644578
注意:由于之前设置了guest密码,对应程序(amqp_listen.c和amqp_sendstring.c)里面也需要修改
c++接口有2个:
https://github.com/alanxz/SimpleAmqpClient
https://github.com/akalend/amqpcpp
未用到以后再测
(5)go语言接口
download: https://github.com/streadway/amqp
tutorial: https://github.com/rabbitmq/rabbitmq-tutorials/tree/master/go
上面网页写到很详细,就不重复了
(6)node.js
https://github.com/squaremo/amqp.node
https://github.com/squaremo/rabbit.js
貌似前者使用的较多
(7)dotnet
https://github.com/EasyNetQ/EasyNetQ
以上是关于rabbitmq, windows/linux, c/c++/node.js/golang/dotnet的主要内容,如果未能解决你的问题,请参考以下文章