1. 程式人生 > >CentOS 7安裝新版RabbitMQ解決Erlang 19.3版本依賴

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 [email protected]
|/
[ ] 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
[[email protected] ~]# 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 [email protected]
The following plugins have been enabled:
rabbitmq_delayed_message_exchange

started 1 plugins.