CentOS6.x安裝RabbitMQ

1、安裝依賴文件

1 yum install build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc-c++ kernel-devel m4 ncurses-devel tk tcl -y

2、安裝Erlang

1.安裝

1 #下載地址:http://www.erlang.org/downloads 選擇對應的版本下載
2 tar zxvf otp_src_19.2.tar.gz
3 cd otp_src_19.2
4 ./configure --prefix=/usr/local/erlang --enable-hipe --enable-threads --enable-smp-support --enable-kernel-poll --without-javac
5 make && make install

2.校驗是否安裝成功

1 #驗證是否安裝成功
2 cd /usr/local/erlang/bin
3 [root@will bin]# ./erl
4 Erlang/OTP 19 [erts-8.2] [source] [async-threads:10] [hipe] [kernel-poll:false]
5 
6 Eshell V8.2  (abort with ^G)
7 1> halt().
8 #當出現以上信息時表示安裝完成。而後輸入halt().退出便可

 

3、安裝RabbitMQ

1.安裝

 1 #下載地址:http://www.rabbitmq.com/releases/rabbitmq-server/ 選擇對應的版本下載
 2 tar zxvf rabbitmq-server-generic-unix-3.6.6.tar.gz
 3 mv rabbitmq_server-3.6.6 /usr/local/rabbitmq
 4 
 5 #vim /etc/profile文件,增長下面的環境變量
 6 #set erlang environment
 7 export PATH=$PATH:/usr/local/erlang/bin
 8 
 9 #set rabbitmq environment
10 export PATH=$PATH:/usr/local/rabbitmq/sbin
11 
12 #使得文件生效
13 source /etc/profile 

2.啓動服務

後臺啓動服務
/usr/local/rabbitmq/sbin/rabbitmq-server -detached

查看服務狀態
/usr/local/rabbitmq/sbin/rabbitmqctl statusjava

結果顯示爲下圖,則證實安裝成功node

[root@will ~]# /usr/local/rabbitmq/sbin/rabbitmqctl status
Status of node rabbit@will ...
[{pid,1980},
 {running_applications,
     [{rabbitmq_management,"RabbitMQ Management Console","3.6.6"},
      {rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.6.6"},
      {webmachine,"webmachine","1.10.3"},
      {mochiweb,"MochiMedia Web Server","2.13.1"},
      {syntax_tools,"Syntax tools","2.1.1"},
      {rabbitmq_management_agent,"RabbitMQ Management Agent","3.6.6"},
      {rabbit,"RabbitMQ","3.6.6"},
      {os_mon,"CPO  CXC 138 46","2.4.1"},
      {ssl,"Erlang/OTP SSL application","8.1"},
      {public_key,"Public key infrastructure","1.3"},
      {asn1,"The Erlang ASN1 compiler version 4.0.4","4.0.4"},
      {compiler,"ERTS  CXC 138 10","7.0.3"},
      {mnesia,"MNESIA  CXC 138 12","4.14.2"},


.............

{run_queue,0}, {uptime,6}, {kernel,{net_ticktime,60}}]

 

4、RabbitMQ經常使用命令

1.關閉rabbitmq服務
/usr/local/rabbitmq/sbin/rabbitmqctl stop

ps -ef | grep rabbit 和 kill -9 xxx

2.開啓插件管理頁面
/usr/local/rabbitmq/sbin/rabbitmq-plugins enable rabbitmq_management

3.建立用戶
/usr/local/rabbitmq/sbin/rabbitmqctl add_user rabbitadmin 123456 (添加用戶名密碼)
/usr/local/rabbitmq/sbin/rabbitmqctl set_user_tags rabbitadmin administrator(設置tags)
/usr/local/rabbitmq/sbin/rabbitmqctl add_vhost will_test (添加vhost)
/usr/local/rabbitmq/sbin/rabbitmqctl set_permissions -p will_test rabbitadmin ".*" ".*" ".*" (爲某個用戶設置vhost)c++


4.WEB登陸(關閉防火牆/開放15672端口)
http://192.168.1.188:15672web

相關文章
相關標籤/搜索