最近在给数据平台做管理后台,有一个功能是往队列头里面仍一个用户,我们的队列用的是RabbitMQ,下面让我们来安装一下RabbitMQ。 RabbitMQ 是由 LShift 提供的一个 Advanced Message Queuing Protocol (AMQP) 的开源实现,由以高性能、健壮以及可伸缩性出名的 Erlang 写成,因此也是继承了这些优点。 首先我们需要安装一下Erlang
[root@web-2 otp_src_R15B01]# wget http://erlang.org/download/otp_src_R15B01.tar.gz [root@web-2 otp_src_R15B01]# tar zxvf otp_src_R15B01.tar.gz [root@web-2 otp_src_R15B01]# cd otp_src_R15B01 [root@web-2 otp_src_R15B01]# ./configure --prefix=/home/software/erlang
这里提示一下如果用不上java编译了,可以在configure时增加 –disable-java
configure: error: No curses library functions found
configure: error: /bin/sh '/root/otp_src_R15B01/erts/configure' failed for erts
期间出现以上两种错误解决办法如下:
a)、如果你的系统是RedHat系列: yum list|grep ncurses yum -y install ncurses-devel b)、如果你的系统是Ubuntu或Debian: apt-cache search ncurses apt-get install libncurses5-dev
接着在进行
./configure --prefix=/home/software/erlang [root@web-2 otp_src_R15B01]# make && make install
到此为止erlang安装完毕,为了方便使用
[root@web-2 otp_src_R15B01]# ln -s /home/software/erlang/bin/erl /usr/local/bin/erl下面测试一下
[root@web-2 otp_src_R15B01]# erl Erlang R15B01 (erts-5.9.1) [source] [64-bit] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.1 (abort with ^G) 1> halt(). [root@web-2 otp_src_R15B01]# OK. 成功了。
下面安装rabbitmq
[root@web-2 ~]# wget http://www.rabbitmq.com/releases/rabbitmq-server/v2.8.6/rabbitmq-server-generic-unix-2.8.6.tar.gz [root@web-2 ~]# tar zxvf rabbitmq-server-generic-unix-2.8.6.tar.gz [root@web-2 ~]# mv rabbitmq_server-2.8.6 /home/software/rabbitmq
rabbitmq安装完毕。下面启动
[root@web-2 rabbitmq]# /home/software/rabbitmq/sbin/rabbitmq-server start
Activating RabbitMQ plugins ...
******************************************************************************** *WARNING* Undefined function crypto:des3_cbc_decrypt/5 *WARNING* Undefined function crypto:start/0 *WARNING* Undefined function ssl:close/1 *WARNING* Undefined function ssl:connection_info/1 *WARNING* Undefined function ssl:controlling_process/2 *WARNING* Undefined function ssl:getopts/2 *WARNING* Undefined function ssl:peercert/1 *WARNING* Undefined function ssl:peername/1 *WARNING* Undefined function ssl:recv/3 *WARNING* Undefined function ssl:send/2 *WARNING* Undefined function ssl:setopts/2 *WARNING* Undefined function ssl:sockname/1 *WARNING* Undefined function ssl:ssl_accept/3 ********************************************************************************
0 plugins activated:
+---+ +---+ | | | | | | | | | | | | | +---+ +-------+ | | | RabbitMQ +---+ | | | | | | v2.8.6 +---+ | | | +-------------------+ AMQP 0-9-1 / 0-9 / 0-8 Copyright (C) 2007-2012 VMware, Inc. Licensed under the MPL. See http://www.rabbitmq.com/
node : rabbit@web-2 app descriptor : /home/software/rabbitmq/sbin/../ebin/rabbit.app home dir : /root config file(s) : (none) cookie hash : tmjfQH+vD8qej0Kbl+nUkw== log : ./../var/log/rabbitmq/rabbit@web-2.log sasl log : ./../var/log/rabbitmq/rabbit@web-2-sasl.log database dir : /home/software/rabbitmq/sbin/../var/lib/rabbitmq/mnesia/rabbit@web-2 erlang version : 5.9.1
-- rabbit boot start starting file handle cache server ...done starting worker pool ...done starting database ...done starting database sync ...done starting codec correctness check ...done -- external infrastructure ready starting statistics event manager ...done starting logging server ...done starting plugin registry ...done starting auth mechanism amqplain ...done starting auth mechanism cr-demo ...done starting auth mechanism plain ...done starting exchange type direct ...done starting exchange type fanout ...done starting exchange type headers ...done starting exchange type topic ...done -- kernel ready starting node monitor ...done starting cluster delegate ...done starting guid generator ...done starting alarm handler ...done starting memory monitor ...done -- core initialized starting empty DB check ...done starting exchange, queue and binding recovery ...done starting mirror queue slave sup ...done starting adding mirrors to queues ...done -- message delivery logic ready starting error log relay ...done starting networking ...done starting notify cluster nodes ...done starting direct client ...done
broker running
正常。
如果出现一下情况,是端口被占用了。 netstat -nltp | grep 5672 看看是哪个占用的,然后kill掉就ok了 BOOT FAILED =========== Error description: {could_not_start_tcp_listener,{"::",5672}}
查看状态
[root@web-2 rabbitmq]# /home/software/rabbitmq/sbin/rabbitmqctl status
Status of node 'rabbit@web-2' ... [{pid,1368}, {running_applications,[{rabbit,"RabbitMQ","2.8.6"}, {os_mon,"CPO CXC 138 46","2.2.9"}, {sasl,"SASL CXC 138 11","2.2.1"}, {mnesia,"MNESIA CXC 138 12","4.7"}, {stdlib,"ERTS CXC 138 10","1.18.1"}, {kernel,"ERTS CXC 138 10","2.15.1"}]}, {os,{unix,linux}}, {erlang_version,"Erlang R15B01 (erts-5.9.1) [source] [64-bit] [async-threads:30] [hipe] [kernel-poll:true]\n"}, {memory,[{total,26027112}, {processes,10170994}, {processes_used,10170980}, {system,15856118}, {atom,504409}, {atom_used,476631}, {binary,207744}, {code,11952993}, {ets,777688}]}, {vm_memory_high_watermark,0.4}, {vm_memory_limit,414960844}, {disk_free_limit,1000000000}, {disk_free,16984993792}, {file_descriptors,[{total_limit,924}, {total_used,3}, {sockets_limit,829}, {sockets_used,1}]}, {processes,[{limit,1048576},{used,117}]}, {run_queue,0}, {uptime,101}] ...done. 停止服务
[root@web-2 rabbitmq]# /home/software/rabbitmq/sbin/rabbitmqctl stop
Stopping and halting node 'rabbit@web-2' ... ...done.
大功告成。 (责任编辑:IT) |