1. 程式人生 > >rabbitmq部署記錄一

rabbitmq部署記錄一

where chm ... src admin mqc mpi cprofile start

部署環境說明:centos7.2
1.安裝依賴庫&模塊

yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel

ncurses模塊安裝如下

yum install perl

yum -y install ncurses-devel

yum install ncurses-devel

2.安裝erlang
說明:rabbitmq依賴erlang
2.1上傳部署包並解壓
上傳otp_src_18.2.1.tar.gz並解壓到/opt目錄下

cd /;mkdir /home/erlang

cd /opt/otp_src_18.2.1;chmod +x ;./configure --prefix=/home/erlang
成功的標誌:
********************************************************************

********************** APPLICATIONS DISABLED **********************
*********************************************************************

jinterface : No Java compiler found
odbc : ODBC library - link check failed



********************** APPLICATIONS INFORMATION *******************
*********************************************************************

wx : wxWidgets not found, wx will NOT be usable



********************** DOCUMENTATION INFORMATION ******************
*********************************************************************

documentation :
fop is missing.
Using fakefop to generate placeholder PDF files.


2.2編譯並安裝

cd /opt/otp_src_18.2.1 && make -j4 && make install

2.3添加環境變量並生效
/etc/profile文件,增加下面的環境變量

vim /etc/profile

ERL_HOME=/home/erlang
PATH=$ERL_HOME/bin:$PATH
export ERL_HOME PATH
生效#source /etc/profile

2.4測試驗證

whereis erlang

erlang: /usr/local/erlang

erl

Erlang/OTP 18 [erts-7.2.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.2.1 (abort with ^G)

3.rabbitmq安裝
3.1準備工作
安裝python2.7.5

yum -y install xmlto

解壓rabbitmq-server-generic-unix-3.6.9.tar.xz到/home目錄下為rabbitmq_server-3.6.9
軟連接

cd /;ln -s /home/rabbitmq_server-3.6.9 /home/rabbitmq

3.2添加環境變量

vim /etc/profile

rabbitmq

export RABBITBIN=/home/rabbitmq/sbin
export PATH=$PATH:$RABBITBIN
生效#source /etc/profile
3.3編寫啟動腳本並啟動

cd /home/rabbitmq;vim start.sh

!/bin/bash

sbin/rabbitmq-server start &

cd /home/rabbitmq && ./start.sh

rabbitmq_server-3.6.9/sbin]# ls
rabbitmqctl rabbitmq-defaults rabbitmq-env rabbitmq-plugins rabbitmq-server

netstat -tnlp | grep 5672端口
3.4添加用戶並授權
添加用戶:rabbitmqctl add_user admin admin
添加權限:rabbitmqctl set_permissions -p "/" admin "." "." ".*"
修改用戶角色:rabbitmqctl set_user_tags admin administrator

./rabbitmqctl add_user admin admin

Creating user "admin" ...
[root@localhost sbin]# ./rabbitmqctl set_permissions -p "/" admin "." "." ".*"
Setting permissions for user "admin" in vhost "/" ...
[root@localhost sbin]# ./rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...

3.5刪除guest用戶

rabbitmqctl delete_user guest

3.6修改admin用戶密碼為123456

rabbitmqctl change_password admin 123456

查看當前用戶列表

rabbitmqctl list_users

Listing users ...
admin [administrator]
3.7啟動網頁管理
開啟網頁控制臺

cd /home/rabbitmq/sbin;./rabbitmq-plugins enable rabbitmq_management

瀏覽器輸入192.168.1.2:15672 使用賬號admin 密碼123456登陸成功

註意:如果登陸失敗則要檢查自己的防火墻有沒有放開端口15672

rabbitmq部署記錄一