CentOS 7安装新版RabbitMQ解决Erlang 19.3版本依赖

通过yum等软件仓库都可以直接安装RabbitMQ,但版本一般都较为保守。
RabbitMQ官网提供了新版的rpm包(http://www.rabbitmq.com/download.html),但是安装的时候会提示需要erlang版本>=19.3,然而默认yum仓库中的版本较低。
其实RabbitMQ在github上有提供新的erlang包(https://github.com/rabbitmq/erlang-rpm
也可以直接加到yum源中
#vim /etc/yum.repos.d/rabbitmq-erlang.repo
[rabbitmq-erlang]
name=rabbitmq-erlang
baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7
gpgcheck=1
gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
repo_gpgcheck=0
enabled=1 #yum clean all
#yum makecache

然后下载RabbitMQ的RPM包(http://www.rabbitmq.com/download.html)

这里是centos7的版本
#wget https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.4/rabbitmq-server-3.7.4-1.el7.noarch.rpm
#yum install rabbitmq-server-3.7.4-1.el7.noarch.rpm

*yum会自动去源里安装依赖包 ,如果提示有erlang 依赖低版本的问题, 可先yum remove 低版本的包, 再进行安装.

安装到这里就完成了,下面进行简单的配置

启动RabbitMQ服务
#service rabbitmq-server start
状态查看
#rabbitmqctl status
启用插件
#rabbitmq-plugins enable rabbitmq_management
重启服务
#service rabbitmq-server restart
添加帐号:name 密码:passwd
#rabbitmqctl add_user name passwd
赋予其administrator角色
#rabbitmqctl set_user_tags name administrator
设置权限
#rabbitmqctl set_permissions -p / name ".*" ".*" ".*"

然后就能够访问http://ip:15672进入web管理页面了(外部访问别忘记修改防火墙)。

firewall-cmd --zone=public --add-port=15672/tcp --permanent
firewall-cmd --reload

rabbitmq常用命令

    add_user        <UserName> <Password>

    delete_user    <UserName>

    change_password <UserName> <NewPassword>

    list_users

    add_vhost    <VHostPath>

    delete_vhost <VHostPath>

    list_vhostsset_permissions  [-p <VHostPath>] <UserName> <Regexp> <Regexp> <Regexp>

    clear_permissions [-p <VHostPath>] <UserName>

    list_permissions  [-p <VHostPath>]

    list_user_permissions <UserName>

    list_queues    [-p <VHostPath>] [<QueueInfoItem> ...]

    list_exchanges [-p <VHostPath>] [<ExchangeInfoItem> ...]

    list_bindings  [-p <VHostPath>]

    list_connections [<ConnectionInfoItem> ...]

rabbitmq安装rabbitmq_delayed_message_exchange插件

1.  检查本地是否安装rabbitmq_delayed_message_exchange插件:

rabbitmq-plugins list
Configured: E = explicitly enabled; e = implicitly enabled
| Status: * = running on rabbit@t4
|/
[ ] rabbitmq_amqp1_0 3.7.7
[ ] rabbitmq_auth_backend_cache 3.7.7
[ ] rabbitmq_auth_backend_http 3.7.7
[ ] rabbitmq_auth_backend_ldap 3.7.7
[ ] rabbitmq_auth_mechanism_ssl 3.7.7
[ ] rabbitmq_consistent_hash_exchange 3.7.7
[ ] rabbitmq_event_exchange 3.7.7
[ ] rabbitmq_federation 3.7.7
[ ] rabbitmq_federation_management 3.7.7
[ ] rabbitmq_jms_topic_exchange 3.7.7
[E*] rabbitmq_management 3.7.7
[e*] rabbitmq_management_agent 3.7.7
[ ] rabbitmq_mqtt 3.7.7
[ ] rabbitmq_peer_discovery_aws 3.7.7
[ ] rabbitmq_peer_discovery_common 3.7.7
[ ] rabbitmq_peer_discovery_consul 3.7.7
[ ] rabbitmq_peer_discovery_etcd 3.7.7
[ ] rabbitmq_peer_discovery_k8s 3.7.7
[ ] rabbitmq_random_exchange 3.7.7
[ ] rabbitmq_recent_history_exchange 3.7.7
[ ] rabbitmq_sharding 3.7.7
[ ] rabbitmq_shovel 3.7.7
[ ] rabbitmq_shovel_management 3.7.7
[ ] rabbitmq_stomp 3.7.7
[ ] rabbitmq_top 3.7.7
[ ] rabbitmq_tracing 3.7.7
[ ] rabbitmq_trust_store 3.7.7
[e*] rabbitmq_web_dispatch 3.7.7
[ ] rabbitmq_web_mqtt 3.7.7
[ ] rabbitmq_web_mqtt_examples 3.7.7
[ ] rabbitmq_web_stomp 3.7.7
[ ] rabbitmq_web_stomp_examples 3.7.7
You have new mail in /var/spool/mail/root
[root@t4 ~]# rabbitmq-plugins enable rabbitmq_delayed_message_exchange
Error:
{:plugins_not_found, [:rabbitmq_delayed_message_exchange]}

通过上述命令发现插件 rabbitmq_delayed_meaage_exchange没有安装,需要下载安装

2.  下载rabbitmq_delayed_meaage_exchange
       下载地址:http://www.rabbitmq.com/community-plugins.html

linux: wget https://dl.bintray.com/rabbitmq/community-plugins/3.7.x/rabbitmq_delayed_message_exchange/rabbitmq_delayed_message_exchange-20171201-3.7.x.zip

unzip ,解压到: /usr/lib/rabbitmq/lib/rabbitmq_server-version/plugins/rabbitmq_delayed_message_exchange-20171201-3.7.x.ez

3.  安装插件
    命令:

#rabbitmq-plugins enable rabbitmq_delayed_message_exchange

The following plugins have been configured:
rabbitmq_delayed_message_exchange
rabbitmq_management
rabbitmq_management_agent
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@t5...
The following plugins have been enabled:
rabbitmq_delayed_message_exchange started 1 plugins.
上一篇:C#简单注册表操作实例


下一篇:Facebook 的系统架构(转)