CentOS7下RabbitMQ服務安裝配置
RabbitMQ是流行的開源訊息佇列系統,是AMQP
(Advanced Message Queuing Protocol高階訊息佇列協議)的標準實現,用erlang
語言開發。RabbitMQ
據說具有良好的效能和時效性,同時還能夠非常好的支援叢集和負載部署,非常適合在較大規模的分散式系統中使用,具體特性還在驗證中,待檢驗。由於專案需要,安裝並配置了RabbitMQ
,伺服器作業系統是CentOS7
。具體步驟如下:
安裝依賴檔案:
yum install gcc glibc-devel make ncurses-devel openssl-devel xmlto
1.Erlang安裝配置
下載安裝包,地址http://www.erlang.org/downloads,我選擇的是otp_src_18.3.tar.gz
。
然後解壓檔案:
[root@vm_os rabbitmq]# tar -xzvf otp_src_18.3.tar.gz
[root@vm_os rabbitmq]# cd otp_src_18.3/
配置安裝路徑編譯程式碼:
[root@vm_os otp_src_18.3]# ./configure --prefix=/opt/erlang
執行編譯結果:
[root@vm_os otp_src_18.3]# make && make install
完成後進入/opt/erlang檢視執行結果
[root@vm_os rabbitmq]# cd /opt/erlang/
[root@vm_os erlang]# erl
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.3 (abort with ^G)
1>
當出現以上資訊時表示安裝完成。然後輸入’halt().’退出即可。
然後在配置Erlang環境變數,vi /etc/profile
檔案,增加下面的環境變數:
#set erlang environment
export PATH=$PATH:/opt/erlang/bin
source /etc/profile
#使得檔案生效
在安裝Erlang過程中,可能會遇到以下問題,一般都是因為系統中缺少相應的包引起的,缺少什麼包直接yum安裝即可。
2.下載安裝RabbitMq
[root@vm_os rabbitmq]# weget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-generic-unix-3.6.1.tar.xz
解壓檔案
[root@vm_os rabbitmq]# xz -d rabbitmq-server-generic-unix-3.6.1.tar.xz
[root@vm_os rabbitmq]# tar -xvf rabbitmq-server-generic-unix-3.6.1.tar -C /opt
解壓後進入資料夾/opt發現多了個資料夾rabbitmq-server-generic-unix-3.6.1
,重新命名為rabbitmq
以便記憶。
然後在配置rabbitmq環境變數,vi /etc/profile
檔案,增加下面的環境變數:
#set rabbitmq environment
export PATH=$PATH:/opt/rabbitmq/sbin
source /etc/profile
使得檔案生效
3.RabbitMQ服務啟動關閉
以上就已經完成了RabbitMq的安裝,怎麼啟動服務呢?
啟動服務:
[root@vm_os rabbitmq]# cd sbin/
[root@vm_os sbin]# ./rabbitmq-server -detached
檢視服務狀態:
[root@vm_os sbin]# ./rabbitmqctl status
Status of node rabbit@vm_os ...
[{pid,11849},
{running_applications,
[{rabbitmq_management,"RabbitMQ Management Console","3.6.1"},
{rabbitmq_management_agent,"RabbitMQ Management Agent","3.6.1"},
{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.6.1"},
{webmachine,"webmachine","1.10.3"},
{amqp_client,"RabbitMQ AMQP Client","3.6.1"},
{mochiweb,"MochiMedia Web Server","2.13.0"},
{syntax_tools,"Syntax tools","1.7"},
{ssl,"Erlang/OTP SSL application","7.3"},
{public_key,"Public key infrastructure","1.1.1"},
{asn1,"The Erlang ASN1 compiler version 4.0.2","4.0.2"},
{crypto,"CRYPTO","3.6.3"},
{compiler,"ERTS CXC 138 10","6.0.3"},
{inets,"INETS CXC 138 49","6.2"},
{rabbit,"RabbitMQ","3.6.1"},
{mnesia,"MNESIA CXC 138 12","4.13.3"},
{rabbit_common,[],"3.6.1"},
{xmerl,"XML parser","1.3.10"},
{os_mon,"CPO CXC 138 46","2.4"},
{ranch,"Socket acceptor pool for TCP protocols.","1.2.1"},
{sasl,"SASL CXC 138 11","2.7"},
{stdlib,"ERTS CXC 138 10","2.8"},
{kernel,"ERTS CXC 138 10","4.2"}]},
{os,{unix,linux}},
{erlang_version,
"Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:8:8] [async-threads:64] [hipe] [kernel-poll:true]\n"},
{memory,
[{total,64111264},
{connection_readers,0},
{connection_writers,0},
{connection_channels,0},
{connection_other,2808},
{queue_procs,2808},
{queue_slave_procs,0},
{plugins,367288},
{other_proc,19041296},
{mnesia,61720},
{mgmt_db,158696},
{msg_index,47120},
{other_ets,1372440},
{binary,128216},
{code,27368230},
{atom,992409},
{other_system,14568233}]},
{alarms,[]},
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,6556241100},
{disk_free_limit,50000000},
{disk_free,37431123968},
{file_descriptors,
[{total_limit,65435},
{total_used,2},
{sockets_limit,58889},
{sockets_used,0}]},
{processes,[{limit,1048576},{used,204}]},
{run_queue,0},
{uptime,412681},
{kernel,{net_ticktime,60}}]
關閉服務:
[root@vm_os sbin]# ./rabbitmqctl stop
Stopping and halting node rabbit@vm_os ...
4. 配置網頁外掛
首先建立目錄,否則可能報錯:
mkdir /etc/rabbitmq
然後啟用外掛:
./rabbitmq-plugins enable rabbitmq_management
配置linux 埠 15672 網頁管理 5672 AMQP埠
然後訪問http://localhost:15672即可
預設使用者guest 密碼guest
5. 遠端訪問配置
預設網頁是不允許訪問的,需要增加一個使用者修改一下許可權,程式碼如下:
新增使用者:rabbitmqctl add_user adminwu 123456
新增許可權:rabbitmqctl set_permissions -p "/" adminwu ".*" ".*" ".*"
修改使用者角色:rabbitmqctl set_user_tags adminwu administrator
然後就可以遠端訪問了,然後可直接配置使用者許可權等資訊。
6. rabbitmq常用命令
add_user <UserName> <Password>
delete_user <UserName>
change_password <UserName> <NewPassword>
list_users
add_vhost <VHostPath>
delete_vhost <VHostPath>
list_vhostsset_permissions [-p <VHostPath>] <UserName> <Regexp> <Regexp> <Regexp>
clear_permissions [-p <VHostPath>] <UserName>
list_permissions [-p <VHostPath>]
list_user_permissions <UserName>
list_queues [-p <VHostPath>] [<QueueInfoItem> ...]
list_exchanges [-p <VHostPath>] [<ExchangeInfoItem> ...]
list_bindings [-p <VHostPath>]
list_connections [<ConnectionInfoItem> ...]
相關文章
- RabbitMQ服務安裝配置MQ
- CentOS7下RabbitMQ3.7安裝與配置CentOSMQ
- RabbitMQ學習系列一:windows下安裝RabbitMQ服務MQWindows
- 安裝RabbitMQ Server服務MQServer
- Centos7安裝RabbitMQCentOSMQ
- linux下安裝、配置samba服務LinuxSamba
- RabbitMQ訊息佇列-Centos7下安裝RabbitMQ3.6.1MQ佇列CentOS
- LINUX下VNC服務的安裝配置LinuxVNC
- linux下Samba服務配置與安裝LinuxSamba
- centos7下cobbler安裝配置CentOS
- Centos7下安裝配置RedsocksCentOS
- Nginx服務安裝配置Nginx
- RabbitMQ Centos7 安裝以及使用MQCentOS
- Centos7下安裝配置elasticsearch 6.3.1CentOSElasticsearch
- Rabbitmq安裝與配置MQ
- RabbitMQ安裝配置(CentOS)MQCentOS
- 服務端常見服務安裝及配置服務端
- CentOS.7下安裝配置FTP和SFTP服務CentOSFTP
- Centos7安裝Xrdp遠端桌面服務CentOS
- CentOS7 zabbix服務 簡單安裝文件CentOS
- CentOS7 下 Nginx 的安裝和配置CentOSNginx
- Centos7下安裝配置MySQL5.7CentOSMySql
- Kali Linux常用服務配置教程安裝及配置DHCP服務Linux
- Linux平臺下snmp服務的安裝和配置Linux
- RabbitMQ學習之(二)_Centos6下安裝RabbitMQ及管理配置MQCentOS
- 在 CentOS7 上安裝 zookeeper-3.4.9 服務CentOS
- windows下安裝Tomcat服務WindowsTomcat
- 在 windows下安裝rabbitmqWindowsMQ
- Linux下安裝RabbitMQLinuxMQ
- CentOS6.7安裝配置nfs服務CentOSNFS
- Linux & Windows 環境下 RabbitMQ 安裝與基本配置LinuxWindowsMQ
- Centos7安裝部署openstack--nova計算服務CentOS
- CentOS7 redis安裝 並作為基礎服務CentOSRedis
- Centos7、Erlang-21.3、RabbitMQ-3.8.0安裝CentOSMQ
- centos7二進位制方式安裝rabbitmqCentOSMQ
- CentOS7下MySQL5.7安裝與配置(YUM)CentOSMySql
- 最小化安裝centos7下配置網路CentOS
- centos7下ldap服務搭建CentOSLDA