RabbitMQ系列之單機模式安裝

關於 RabbitMQ 的安裝,官方 文檔裏對不一樣的操做系統的安裝都介紹的很詳細。
本文主要記錄一下本人使用 macOS 安裝時遇到的問題以及解決辦法,方便之後查閱。

操做系統版本

macOS Sierra,版本 10.12.6。html

安裝

使用 macOS 安裝 RabbitMQ 很是方便,推薦使用 Homebrew 包管理器。git

1. 先安裝 Homebrew

若是本機沒有安裝 Homebrew(能夠經過在終端輸入 brew 指令來判斷),請執行如下命令:github

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

回車便可。vim

安裝失敗

因爲須要下載國外的源,有可能會報 443的錯誤:瀏覽器

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
解決辦法一

若是有fq工具打開fq工具便可暴力解決。bash

解決辦法二
  1. 查看網址對應的 IP 地址
    打開https://www.ipaddress.com/,查詢raw.githubusercontent.com對應的 IP 地址:
    ipaddress.png
  2. 修改系統的host文件微信

    sudo vim /etc/hosts

    打開 hosts 文件,將剛剛查詢到的 IP 地址添加進去:curl

    199.232.68.133  raw.githubusercontent.com

    保存後,從新執行上面貼出的安裝 Homebrew 命令。工具

2. 安裝RabbitMQ

#自動升級homebrew

brew update

#安裝RabbitMQ server

brew install rabbitmq

備註:ui

RabbitMQ 的運行須要依賴 Erlang 環境,使用此安裝命令會自動幫咱們安裝 Erlang 環境及其依賴,這就是使用 brew 的方便之處。

安裝失敗

因爲 brew 默認的官方更新源都是存放在 GitHub 上的,所以速度太慢常常會致使下載 Erlang 或其它依賴時常常下載失敗:

Error: Failed to download resource "erlang"

Download failed: https://homebrew.bintray.com/bottles/.....
解決辦法

最好的解決辦法是更換成國內的鏡像源。
Homebrew 的更新源由三部分組成:本體(brew.git)、核心(homebrew-core.git)以及二進制預編譯包(homebrew-bottles),我這裏使用的是中國科大的鏡像。

1.替換brew.git

$ cd "$(brew --repo)"

$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

2.替換homebrew-core.git

$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

3.替換homebrew-cask

$ cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask

$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

4.替換Homebrew Bottles源

$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile

$ source ~/.bash_profile

3. 安裝成功

安裝完成後能夠用brew info rabbitmq檢查信息:

$ brew info rabbitmq

rabbitmq: stable 3.8.3

Messaging broker

https://www.rabbitmq.com

/usr/local/Cellar/rabbitmq/3.8.3 (281 files, 20.4MB) 

Built from source on 2020-05-02 at 19:04:15

From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/rabbitmq.rb

==> Dependencies

Required: erlang ✔

==> Caveats

Management Plugin enabled by default at http://localhost:15672

Bash completion has been installed to:

/usr/local/etc/bash_completion.d

To have launchd start rabbitmq now and restart at login:

brew services start rabbitmq

Or, if you don't want/need a background service you can just run:

rabbitmq-server

==> Analytics

install: 9,648 (30 days), 33,180 (90 days), 137,570 (365 days)

install-on-request: 9,471 (30 days), 32,348 (90 days), 132,710 (365 days)

build-error: 0 (30 days)
訪問 rabbitmq 管理界面

瀏覽器訪問http://localhost:15672,用戶名和密碼都是 guest:
localhost.png

關注微信公衆號

歡迎你們關注個人微信公衆號閱讀更多文章:
微信公衆號二維碼.jpg

相關文章
相關標籤/搜索