安装Erlang
去官网下载Erlang的最新版本:https://www.erlang.org/downloads
我这里下载的是OTP 21.0.1 Windows 64-bit Binary File。
下载下来点击一步步进行安装,我的安装位置是D:\Program Files\erl10.0.1
安装好之后,
添加环境变量ERLANG_HOME
为D:\Program Files\erl10.0.1
;
将D:\Program Files\erl10.0.1\bin
添加进环境变量。
然后打开命令行,输入:erl
,看到如下效果证明安装好了:
C:\Users\zifeiy>erl
Eshell V10.0.1 (abort with ^G)
1>
安装RabbitMQ
去RabbitMQ官网下载RabbitMQ的最新版本:http://www.rabbitmq.com/install-windows.html
我这里是3.7.7,然后选择 Installer for Windows systems 进行下载。
我的RabbitMQ的安装位置是:D:\Program Files\RabbitMQ Server
所以,添加环境变量RABBITMQ_HOME
为D:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.7
;
在PATH中添加D:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.7\sbin
。
运行RabbitMQ
在命令行输入:rabbitmq-server -detached
运行RabbitMQ,
其中,参数“-detached”是为了能够让RabbitMQ服务以守护进程的方式在后台运行,
这样就不会因为当前Shell窗口的关闭二影响服务。
不过我运行的时候报错了:
C:\Users\zifeiy>rabbitmq-server --detached
ERROR: node with name "rabbit" already running on "DESKTOP-SJ5OR11"
按照这个报错信息,应该是说RabbitMQ服务已经启动起来了。
所以跳过这一步,直接在命令行输入rabbitmqctl status
来查看RabbitMQ是否正常启动:
C:\Users\zifeiy>rabbitmqctl status
Status of node rabbit@DESKTOP-SJ5OR11 ...
[{pid,13076},{running_applications,[{rabbit,"RabbitMQ","3.7.7"},{mnesia,"MNESIA CXC 138 12","4.15.4"},{rabbit_common,"Modules shared by rabbitmq-server and rabbitmq-erlang-client","3.7.7"},{ranch_proxy_protocol,"Ranch Proxy Protocol Transport","1.5.0"},{ranch,"Socket acceptor pool for TCP protocols.","1.5.0"},{ssl,"Erlang/OTP SSL application","9.0"},{public_key,"Public key infrastructure","1.6"},{asn1,"The Erlang ASN1 compiler version 5.0.6","5.0.6"},{os_mon,"CPO CXC 138 46","2.4.5"},{inets,"INETS CXC 138 49","7.0"},{xmerl,"XML parser","1.3.17"},{jsx,"a streaming, evented json parsing toolkit","2.8.2"},{recon,"Diagnostic tools for production use","2.3.2"},{crypto,"CRYPTO","4.3"},{lager,"Erlang logging framework","3.6.3"},{goldrush,"Erlang event stream processor","0.1.9"},{compiler,"ERTS CXC 138 10","7.2.1"},{syntax_tools,"Syntax tools","2.1.5"},{syslog,"An RFC 3164 and RFC 5424 compliant logging framework.","3.4.2"},{sasl,"SASL CXC 138 11","3.2"},{stdlib,"ERTS CXC 138 10","3.5"},{kernel,"ERTS CXC 138 10","6.0"}]},{os,{win32,nt}},{erlang_version,"Erlang/OTP 21 [erts-10.0.1] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:64]\n"},{memory,[{connection_readers,0},{connection_writers,0},{connection_channels,0},{connection_other,0},{queue_procs,0},{queue_slave_procs,0},{plugins,11852},{other_proc,23804384},{metrics,185268},{mgmt_db,0},{mnesia,74128},{other_ets,2579496},{binary,218896},{msg_index,29696},{code,24310367},{atom,1082561},{other_system,12302792},{allocated_unused,14502512},{reserved_unallocated,1048576},{strategy,rss},{total,[{erlang,64599440},{rss,80150528},{allocated,79101952}]}]},{alarms,[]},{listeners,[{clustering,25672,"::"},{amqp,5672,"::"},{amqp,5672,"0.0.0.0"}]},{vm_memory_calculation_strategy,rss},{vm_memory_high_watermark,0.4},{vm_memory_limit,3388026060},{disk_free_limit,50000000},{disk_free,73252769792},{file_descriptors,[{total_limit,8092},{total_used,2},{sockets_limit,7280},{sockets_used,0}]},{processes,[{limit,1048576},{used,237}]},{run_queue,1},{uptime,407},{kernel,{net_ticktime,60}}]
看来RabbitMQ已经正常启动了。
也可以通过rabbitmqctl cluster_status
命令来查看集群信息,目前只有一个RabbitMQ服务节点,可以看作单节点的集群:
C:\Users\zifeiy>rabbitmqctl cluster_status
Cluster status of node rabbit@DESKTOP-SJ5OR11 ...
[{nodes,[{disc,['rabbit@DESKTOP-SJ5OR11']}]},{running_nodes,['rabbit@DESKTOP-SJ5OR11']},{cluster_name,<<"rabbit@DESKTOP-SJ5OR11">>},{partitions,[]},{alarms,[{'rabbit@DESKTOP-SJ5OR11',[]}]}]