【rabbitmq】Centos7 下安裝rabbitmq

rabbitmq安裝

rabbitmq的安裝依賴erlang,首先應該先安裝erlang,而後安裝rabbitmq;html

Step1:安裝erlang

erlang-rpm安裝教程
選擇在Centos7 上安裝:
git

To use Erlang 20.x on CentOS 7:github

# In /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://www.rabbitmq.com/rabbitmq-release-signing-key.asc
repo_gpgcheck=0
enabled=1

而後執行:web

yum install erlang

Step2: 安裝rabbitmq

參考連接
centos

下載rpm

wget https://github.com/rabbitmq/rabbitmq-server/releases/download/rabbitmq_v3_6_12/rabbitmq-server-3.6.12-1.el7.noarch.rpm

安裝rpm

rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
yum install rabbitmq-server-3.6.12-1.el7.noarch.rpm

Step3: 設置開機自啓動+開啓服務

chkconfig rabbitmq-server on
/sbin/service rabbitmq-server stop/start/

Step4: Rabbit管理(非必須)

開啓Web管理插件瀏覽器

rabbitmq-plugins enable rabbitmq_management

output:
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management
Applying plugin configuration to rabbit@PC-201602152056... started 6 plugins.

瀏覽器訪問:
http://localhost:15672
默認用戶名和密碼: guest/guest;
須要注意的是:guest用戶僅僅提供localhost做爲ip登陸;
若是遠程登陸,如:http://192.168.35.129:15672/, 則會提示錯誤,登陸不了:app

# 以下是日誌輸出
=WARNING REPORT==== 21-Oct-2017::23:31:33 ===
 HTTP access denied: user 'guest' - User can only log in via localhost

訪問控制可參考:
Access Control (Authentication, Authorisation) in RabbitMQ
爲了讓guest可遠程訪問,須要修改rabbitmq.config中的loopback_users參數,設置爲oop

[{rabbit, [{loopback_users, []}]}].

官網文檔描述以下,可參考官方文檔:RabbitMQ Configurationthis

loopback_users參數:
List of users which are only permitted to connect to the broker via a loopback interface (i.e. localhost).
If you wish to allow the default guest user to connect remotely, you need to change this to [].

Default:  [<<"guest">>]

默認安裝時,rabbitmq.config配置文件可能不存在,有兩種方式能夠設置配置文件;url

  • 方式1: 配置文件默認路徑: /etc/rabbitmq/rabbitmq.config
  • 方式2: 使用環境變量RABBITMQ_CONFIG_FILE指定 rabbitmq.config文件位置;
    說明以下:
If rabbitmq.config doesn't exist, it can be created manually. Set the RABBITMQ_CONFIG_FILE environment variable if you change the location. The Erlang runtime automatically appends the .config extension to the value of this variable.

修改完配置文件後,重啓,就能夠使用guest用戶遠程訪問了;

參考

erlang-rpm
CentOS 7 安裝 RabbitMQ 3.6.12
CentOS7安裝rabbitMQ

相關文章
相關標籤/搜索