2.1.3 启动ActiveMQ
[root@puppetserver rpms]# /etc/rc.d/init.d/activemq start
Starting ActiveMQ Broker...
[root@puppetserver rpms]# chkconfig activemq on
[root@puppetserver rpms]# netstat -nlatp | grep 61613 #查看监听端口
tcp 0 0 :::61613 :::* LISTEN 33805/java
备注:更多详细配置信息请参考
2.2 安装和配置RabbitMQ
2.2.1 安装RabbitMQ
[root@puppetserver rpms]# yum install erlang #RabbitMQ依赖erlang语言,需要安装大概65个左右的erlang依赖包
[root@puppetserver rpms]# yum install rabbitmq-server
[root@puppetserver rpms]# ll /usr/lib/rabbitmq/lib/rabbitmq_server-3.1.5/plugins/ #默认已经安装了stomp插件,老版本需要下载安装
-rw-r--r-- 1 root root 242999 Aug 24 17:42 amqp_client-3.1.5.ez
-rw-r--r-- 1 root root 85847 Aug 24 17:42 rabbitmq_stomp-3.1.5.ez
…
2.2.2 启动rabbitmq-server
[root@puppetserver rpms]# /etc/rc.d/init.d/rabbitmq-server start #启动rabbitmq服务
Starting rabbitmq-server: SUCCESS
rabbitmq-server.
[root@puppetserver rpms]# /etc/rc.d/init.d/rabbitmq-server status #查看rabbitmq状态
Status of node rabbit@puppetserver ...
[{pid,43198},
{running_applications,[{rabbit,"RabbitMQ","3.1.5"},
{mnesia,"MNESIA CXC 138 12","4.5"},
{os_mon,"CPO CXC 138 46","2.2.7"},
{xmerl,"XML parser","1.2.10"},
{sasl,"SASL CXC 138 11","2.1.10"},
{stdlib,"ERTS CXC 138 10","1.17.5"},
{kernel,"ERTS CXC 138 10","2.14.5"}]},
{os,{unix,linux}},
{erlang_version,"Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:30] [kernel-poll:true]\n"},
{memory,[{total,27101856},
{connection_procs,2648},
{queue_procs,5296},
{plugins,0},
{other_proc,9182320},
{mnesia,57456},
{mgmt_db,0},
{msg_index,21848},
{other_ets,765504},
{binary,3296},
{code,14419185},
{atom,1354457},
{other_system,1289846}]},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,838362726},
{disk_free_limit,1000000000},
{disk_free,15992676352},
{file_descriptors,[{total_limit,924},
{total_used,3},
{sockets_limit,829},
{sockets_used,1}]},
{processes,[{limit,1048576},{used,122}]},
{run_queue,0},
{uptime,4}]
...done.
[root@puppetserver rpms]# netstat -nlp | grep beam #默认监听端口为5672
tcp 0 0 0.0.0.0:44422 0.0.0.0:* LISTEN 43198/beam
tcp 0 0 :::5672 :::* LISTEN 43198/beam
2.2.3 配置RabbitMQ
2.2.3.1 加载amqp_client和rabbit_stomp插件
[root@puppetserver sbin]#ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-3.1.5/sbin/rabbitmq-plugins /usr/sbin/rabbitmq-plugins #创建命令rabbitmq-plugins的软连接
[root@puppetserver sbin]# ln -s /usr/lib/rabbitmq/lib/rabbitmq_server-3.1.5/sbin/rabbitmq-env /usr/sbin/rabbitmq-env #创建命令rabbitmq-env的软连接
[root@puppetserver sbin]# rabbitmq-plugins enable rabbitmq_stomp #开启rabbitmq_stomp插件
The following plugins have been enabled:
amqp_client
rabbitmq_stomp
Plugin configuration has changed. Restart RabbitMQ for changes to take effect.
[root@puppetserver sbin]# /etc/rc.d/init.d/rabbitmq-server restart
Restarting rabbitmq-server: SUCCESS
rabbitmq-server.
[root@puppetserver rabbitmq]# tailf /var/log/rabbitmq/rabbit\@puppetserver.log #可以从日志看到stomp插件加载成功
=INFO REPORT==== 3-Oct-2013::20:25:18 ===
started STOMP TCP Listener on [::]:61613
=INFO REPORT==== 3-Oct-2013::20:25:18 ===
Server startup complete; 2 plugins started.
* amqp_client
* rabbitmq_stomp
*
2.2.3.2 创建rabbitmq.config配置文件,修改监听端口为61613
[root@puppetserver rpms]# vim /etc/rabbitmq/rabbitmq.config
[
{stomp,[ {tcp_listeners, [61613]} ]} #设置connector为stomp,监听端口为61613
].
[root@puppetserver rpms]# /etc/rc.d/init.d/rabbitmq-server restart
Restarting rabbitmq-server: SUCCESS
rabbitmq-server.
[root@puppetserver rpms]# netstat -nlp | grep beam #默认监听端口为61613
tcp 0 0 0.0.0.0:56532 0.0.0.0:* LISTEN 1906/beam.smp
tcp 0 0 :::61613 :::* LISTEN 1906/beam.smp
tcp 0 0 :::5672 :::* LISTEN 1906/beam.smp
2.2.3.3 删除默认账户guest,为MCollective创建账户“mcollective”并设置密码为“secret”,然后设置权限。
[root@puppetserver rpms]# rabbitmqctl delete_user guest
Deleting user "guest" ...
...done.
[root@puppetserver rpms]# rabbitmqctl add_user mcollective secret
Creating user "mcollective" ...
...done.
[root@puppetserver rpms]# rabbitmqctl set_permissions -p "/" mcollective ".*" ".*" ".*"
Setting permissions for user "mcollective" in vhost "/" ...
...done.
[root@puppetserver sbin]# rabbitmqctl list_users #查看监听用户
Listing users ...
mcollective []
...done.
备注:RabbitMQ拥有一个默认的guest账户,它默认对消息队列拥有全部权限。出于安全方面的考虑,建议删除这个账户。
更多详细配置信息请参考
更多详细配置信息请参考: