rabbitmq安装完整版
2019獨角獸企業(yè)重金招聘Python工程師標準>>>
1.安裝依賴文件
[root@lugu-wugu-wxfile mq]#?yum install ncurses-devel
[root@lugu-wugu-wxfile mq]#?yum -y install openssl
[root@lugu-wugu-wxfile mq]#?yum -y install ssl
[root@lugu-wugu-wxfile mq]#?yum -y install xmlto
[root@lugu-wugu-wxfile mq]#?yum -y install python-simplejson
[root@lugu-wugu-wxfile mq]#?yum -y install python
進入?http://www.erlang.org/download.html?選擇源文件下載
[root@lugu-wugu-wxfile mq]#?wget?http://www.erlang.org/download/otp_src_17.5.tar.gz
[root@lugu-wugu-wxfile mq]#?tar zxvf otp_src_17.5.tar.gz
[root@lugu-wugu-wxfile mq]#?cd otp_src_17.5
[root@lugu-wugu-wxfile mq]#?./configure
[root@lugu-wugu-wxfile mq]#?make && make install
安裝完成以后,執(zhí)行erl看是否能打開eshell,用’halt().’退出,注意后面的點號,那是erlang的結(jié)束符。
[root@lugu-wugu-wxfile mq]# erl
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V6.4 ?(abort with ^G)
1> 9+1.
10
2> halt().
2.安裝RabbitMQ
下載rabbitmq安裝包
[root@lugu-wugu-wxfile mq]# wget?http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.0/rabbitmq-server-3.6.0.tar.xz
[root@lugu-wugu-wxfile mq]#?xz -d rabbitmq-server-3.6.0.tar.xz
[root@lugu-wugu-wxfile mq]#?tar xvf rabbitmq-server-3.6.0.tar
[root@lugu-wugu-wxfile mq]#?cd rabbitmq-server-3.6.0
[root@lugu-wugu-wxfile mq]#?make
[root@lugu-wugu-wxfile mq]#?make install TARGET_DIR=/opt/rabbitmq SBIN_DIR=/opt/rabbitmq/sbin MAN_DIR=/opt/rabbitmq/man DOC_INSTALL_DIR=/opt/rabbitmq/doc
注意1:可能出現(xiàn)xz:Command not found
xz命令提示linux下提示bash:command?not?found解決方法
http://blog.sina.com.cn/s/blog_ba08e8e00101b1rs.html
注意2:make install時可能會報錯:zip command not found.解決方法如下:
[root@lugu-wugu-wxfile mq]#?yum install -y unzip zip;
3.使用RabbitMQ
啟動MQ
[root@lugu-wugu-wxfile rabbitmq-server-3.6.0]# cd scripts/
[root@lugu-wugu-wxfile scripts]# ./rabbitmq-server -detached
Warning: PID file not written; -detached was passed.
查看狀態(tài)
[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl status
停止服務(wù)
[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl stop
Stopping and halting node 'rabbit@lugu-wugu-wxfile' …
安裝RabbitMQWeb管理插件
[root@lugu-wugu-wxfile scripts]# ./rabbitmq-plugins enable rabbitmq_management
Error: {cannot_write_enabled_plugins_file,"/etc/rabbitmq/enabled_plugins",
? ? ? ? ? ?enoent}
此時需要手動創(chuàng)建/etc/rabbitmq目錄
[root@lugu-wugu-wxfile scripts]# mkdir /etc/rabbitmq
再次安裝即可
[root@lugu-wugu-wxfile scripts]# ./rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
? mochiweb
? webmachine
? rabbitmq_web_dispatch
? amqp_client
? rabbitmq_management_agent
? rabbitmq_management
Applying plugin configuration to rabbit@lugu-wugu-wxfile... failed.
?* Could not contact node rabbit@lugu-wugu-wxfile.
? ?Changes will take effect at broker restart.
?* Options: --online ?- fail if broker cannot be contacted.
? ? ? ? ? ? --offline - do not try to contact broker.
添加賬號
PS:默認賬號guest只能在localhost訪問
[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl add_user admin admin
?
Creating user "admin" …
設(shè)置管理員
[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl set_user_tags admin administrator
?
Setting tags for user "admin" to [administrator] …
設(shè)置讀寫權(quán)限
命令使用戶admin具有/vhost1這個virtual host中所有資源的配置、寫、讀權(quán)限以便管理其中的資源
首先需要創(chuàng)建/vhost1
[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl add_vhost /vhost1
Creating vhost "/vhost1” .
[root@lugu-wugu-wxfile scripts]# ./rabbitmqctl set_permissions -p /vhost1 admin ?'.*' ?'.*' ?'.*'
Setting permissions for user "admin" in vhost "/vhost1" …
然后就可以登錄web頁面了
http://192.168.1.20:15672
轉(zhuǎn)載于:https://my.oschina.net/u/1762811/blog/750323
總結(jié)
以上是生活随笔為你收集整理的rabbitmq安装完整版的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java如何计算对象的大小
- 下一篇: 主动模式FTP与被动模式FTP该如何选择