Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1416984
  • 博文数量: 264
  • 博客积分: 5810
  • 博客等级: 大校
  • 技术积分: 3528
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-13 17:15
文章分类

全部博文(264)

文章存档

2011年(264)

分类: 系统运维

2011-07-14 14:13:58

Server安装篇

需要有Erlang语言支持的平台。支持的平台包括:

·         Solaris

·         BSD

·         Linux《支持redhat系列》

·         MacOSX

·         TRU64

·         Windows NT/2000/XP/Vista/Windows 7

·         Windows Server 2003/2008

·         Windows 95, 98

·         VxWorks

RabbitMQ is officially supported on a limited number of platforms:

·         Ubuntu and Debian-based Linux distributions

·         Fedora and RPM-based Linux distributions

·         openSUSE and derived distributions (including SLES and SLERT)

·         Mac OS X

·         Windows XP and later 

WINDOW安装篇

Install Server Components

下载整包

or convenience, the  already contains the Erlang system installer and the RabbitMQ broker server binary distribution files needed for the next section. It also includes .Net and Java client libraries for RabbitMQ.

Just extract the files from the bundle and then follow the instructions to install each server component. 《将各个服务组件安装起来》

Install Erlang

Install a recent version of Erlang/OTP.  and higher should work on Windows. Extract it from the Windows bundle or choose a version from 

Run the .exe file. Using default installation options, Erlang will appear in the Start Menu, and \erl5.7.4\bin\erl.exe will be inC:\Program Files or C:\Program Files (x86).

我的安装目录:C:\Program Files\erl5.8.3\bin 

ERLANG_HOME

Set ERLANG_HOME to where you actually put your Erlang installation, e.g. C:\Program Files\erl5.7.4 (full path). The RabbitMQ batch files expect to execute %ERLANG_HOME%\bin\erl.exe.

Go to Start > Settings > Control Panel > System > Advanced > Environment Variables. Create the system environment variableERLANG_HOME and set it to the full path of the directory which contains bin\erl.exe.《配置这项环境变量》

创建一个环境变量:ERLANG_HOME 其值为 C:\Program Files\erl5.8.3

至此安装完成!

Install RabbitMQ Server

Download rabbitmq-server-windows-2.5.1.zip from the  or extract it from the Windows bundle.

From the zip file, extract the folder named rabbitmq_server-2.5.1 into C:\Program Files\RabbitMQ (or somewhere suitable for application files).

PS直接将这个文件rabbitmq_server-2.5.1 复制到C:\Program Files\RabbitMQ

相关的命令行

Commands for RabbitMQ Server

Within the rabbitmq_server-2.5.1\sbin directory are some scripts which run commands to control the RabbitMQ server.

这里面就会有一些相关命令可以使用了!

The RabbitMQ server can be run as either an application or service (not both).

  •  starts the broker as an application.《我们用它吧!》
  •  manages the service and starts the broker.
  •  manages a running broker.《共三个》 

Set up the system path so you can find the server and sbin directory easily.

·  Create a system environment variable (e.g. RABBITMQ_SERVER) for "C:\Program Files\RabbitMQ\rabbitmq_server-2.5.1". Adjust this if you put rabbitmq_server-2.5.1 elsewhere, or if you upgrade versions.

·  Append the literal string ";%RABBITMQ_SERVER%\sbin" to your system path (aka %PATH%).

配置环境变量!

#创建一个环境变量RABBITMQ_SERVER 设置其值

#设置环境变量

;%RABBITMQ_SERVER%\sbin

将其配置到系统的环境变量里面去! 

Finding Application Data

By default, the RabbitMQ logs and Mnesia database are stored in the current user's Application Data directory e.g.C:\Documents and Settings\User\Application Data or C:\Documents and Settings\User\AppData\Roaming (Windows Vista).

Execute echo %APPDATA% at a Command Prompt to find this directory. Alternatively, Start > Run %APPDATA% will open this folder.

C:\Users\yaofang.zjl>echo %APPDATA%

C:\Users\yaofang.zjl\AppData\Roaming   可以看到应用数据存储的位置与目录

Start the Broker as an Application

Run the command

rabbitmq-server -detached

Alternatively, you can double-click the rabbitmq-server.bat file in Windows Explorer. 

Stop or Manage the Broker《掮客》

rabbitmq-server only starts the broker. To  use rabbitmqctl commands.

还可以将其运行做为一个服务。而不是server

The service runs using the rabbitmq-service.bat script in sbin. 启一个服务。

Customise RabbitMQ Service Environment Variables

Note: After setting environment variables, you may need to install the service again.

The rabbitmq-service.bat script recognises many of the same environment variables as rabbitmq-server.bat, as well as a few additional service environment variables.

Install the Service

Install the service by running

rabbitmq-service install

A service with the name defined by RABBITMQ_SERVICENAME should now appear in the Windows Services control panel (Start > Run services.msc).

Managing the Service

To manage the service (install, remove, start, stop, enable, disable), use rabbitmq-service.bat commands. Refer to the for more information and troubleshooting guidance. You can also use the Windows Services panel (services.msc) to perform some of the same functions as the service script.

Start the Broker as a Service

To start the broker, execute

rabbitmq-service start

If the output from this command is "Service RABBITMQ_SERVICENAME started", then the service was started correctly.

Confirm the service named RABBITMQ_SERVICENAME reports a "Started" status in Services: 
Start > Run 
services.msc.

Manage the Broker

To  use rabbitmqctl commands. 

To stop the broker or check its status, use rabbitmqctl.bat in sbin (as an administrator). 

红帽上面的安装方法

Install from a package

The RabbitMQ server is included in Fedora, so for Fedora and RHEL users we recommend to install the rabbitmq-server package via the distribution's package manager.

Alternatively, install rabbitmq-server-2.5.1-architecture.rpm (which you can download from the ). We recommend using your distribution's packaged version of Erlang to run the server. See  for more information.

运行起来

       Customise RabbitMQ Environment Variables

The server should start using defaults. You can customise the RabbitMQ environment. Also see how to .

Start the Server

The server is not started as a daemon by default when the RabbitMQ server package is installed. To start the daemon by default when the system boots, as an administrator run chkconfig rabbitmq-server on.

As an administrator, start and stop the server as usual using /sbin/service rabbitmq-server stop/start/etc.

Note: The server is set up to run as system user rabbitmq. If you change the location of the Mnesia database or the logs, you must ensure the files are owned by this user (and also update the environment variables).

Manage the Server

See the  section for info on  commands and .

现在来开始启动SERVER吧!

Install the Service

Install the service by running

rabbitmq-service install

A service with the name defined by RABBITMQ_SERVICENAME should now appear in the Windows Services control panel

从控制面板的服务里面可以看到这个东西启动了。可以将它当成一个服务进行管理! 

测试是否正常运行状态:rabbitmqctl status

This example indicates that no broker is running:

  Status of node 'rabbit@xxx' ...  Error: unable to connect to node 'rabbit@xxx': nodedown  diagnostics:  - nodes and their ports on xxx: [{rabbitmqctl,...}]  - current node: 'rabbitmqctlxxx@xxx'  - current node home dir: [...]  - current node cookie hash: [...]

表示这个服务并未正常开启! 

正常的启动方法:

1、到C:\Program Files\RabbitMQ\rabbitmq_server-2.5.1\sbin 右键点到rabbitmq-server 以管理员的身份进行启动这个服务。

2、到另外一个console下面运行:

C:\Users\yaofang.zjl>rabbitmqctl status

Status of node 'rabbit@TB-YAOFANG' ...

[{pid,6188},

 {running_applications,[{rabbit,"RabbitMQ","2.5.1"},

                        {os_mon,"CPO  CXC 138 46","2.2.5"},

                        {sasl,"SASL  CXC 138 11","2.1.9.3"},

                        {mnesia,"MNESIA  CXC 138 12","4.4.17"},

                        {stdlib,"ERTS  CXC 138 10","1.17.3"},

                        {kernel,"ERTS  CXC 138 10","2.14.3"}]},

 {os,{win32,nt}},

 {erlang_version,"Erlang R14B02 (erts-5.8.3) [smp:4:4] [rq:4] [async-threads:30]

\n"},

 {memory,[{total,13279928},

          {processes,4905408},

          {processes_used,4896944},

          {system,8374520},

          {atom,734421},

          {atom_used,721972},

          {binary,129080},

          {code,5820103},

          {ets,373892}]}]

...done.

表示这个服务正常启动运行!

服务启来了开始学习JAVA-API的应用了

阅读(12202) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~