您的位置:首页 > 运维架构 > Linux

centos 6.4上安装rabbitmq server

2014-05-05 16:51 453 查看


1.安装epel和erlang.

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm[/code] 
wget -O /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo [code]yum install erlang

如果有问题,如以下错误,请检查/etc/yum.repos.d下是否有不必要的repo.可以全部删除,再从干净的系统中把repo拷过来。然后执行

yum clean all,再执行一遍。

Error: Package: erlang-R12B-5.11.el5.x86_64 (epel)

Requires: libodbc.so.1()(64bit)

You could try using --skip-broken to work around the problem

You could try running: rpm -Va --nofiles --nodigest

2.

wget -O ./rabbitmq-server-3.3.1-1.noarch.rpm http://www.rabbitmq.com/releases/rabbitmq-server/v3.3.1/rabbitmq-server-3.3.1-1.noarch.rpm [code]rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
yum install rabbitmq-server-3.3.1-1.noarch.rpm

[/code]

如果出现错误GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

请先执行 yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
然后执行yum install rabbitmq-server-3.3.1-1.noarch.rpm

3添加权限

chown rabbitmq:rabbitmq /var/run/rabbitmq

chown rabbitmq:rabbitmq /var/lock/subsys/rabbitmq-server

4.设置自动启动

chkconfig rabbitmq-server on

5.启动rabbitmq-server

/etc/init.d/rabbitmq-server start

6.验证

rabbitmqctl status

Status of node 'rabbit@houzhizhen-vm1' ...

[{pid,5267},

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

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

{xmerl,"XML parser","1.2.10"},

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

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

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

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

{os,{unix,linux}},

{erlang_version,"Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:30] [kernel-poll:true]\n"},

{memory,[{total,27436088},

{connection_procs,2648},

{queue_procs,5296},

{plugins,0},

{other_proc,9239832},

{mnesia,57152},

{mgmt_db,0},

{msg_index,22072},

{other_ets,773512},

{binary,10128},

{code,14668418},

{atom,1364961},

{other_system,1292069}]},

{alarms,[]},

{listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},

{vm_memory_high_watermark,0.4},

{vm_memory_limit,418013184},

{disk_free_limit,50000000},

{disk_free,26603896832},

{file_descriptors,[{total_limit,924},

{total_used,3},

{sockets_limit,829},

{sockets_used,1}]},

{processes,[{limit,1048576},{used,124}]},

{run_queue,0},

{uptime,3}]

...done.

7.日志地址: /var/log/rabbitmq/

参照:

Installing on RPM-based Linux (CentOS, Fedora, OpenSuse, RedHat)

Download the Server

DescriptionDownload
Packaged as RPM for Fedora / RHEL / CentOS Linuxrabbitmq-server-3.3.1-1.noarch.rpm(Signature)
Packaged as RPM for openSUSE Linuxrabbitmq-server-3.3.1-1.suse.noarch.rpm(Signature)
rabbitmq-server is included in Fedora. However, the versions included are often quite old. You will probably get better results installing the .rpm from our website. Check theFedora
package details for which version of the server is available for which versions of the distribution.

Before installing RabbitMQ, you must install Erlang. We strongly recommend using a packaged version. There are three suggested sources for Erlang packages:

EPEL ("Extra Packages for Enterprise Linux"); part of the Red Hat / Fedora organisation, provides many additional packages, including Erlang. These are the most official packages,
and are split into many small packages, but are not always up to date.
Erlang Solutions produces packages that are usually up to date. They are not split up, and include all of Erlang - which can mean they require large
numbers of dependencies.
VMware produces a package stripped down to only provide those components needed to run RabbitMQ. It may not be as up to date as
Erlang Solutions' packages.

Install Erlang from EPEL or

Note: the steps you need to take vary, depending on which version of RHEL you are on.

Enable
EPEL (all versions)

Follow the steps in the
EPEL FAQ to enable EPEL on your machine.

Enable Erlang repository (RHEL 5 and derived, including Fedora 6 and CentOS 5)

If you are on a later version of RHEL (or derived) you should skip this step.

Due to
the EPEL package update policy, EPEL 5 contains a very old version of Erlang, R12B-5; with whichRabbitMQ is not compatible.

Therefore to use EPEL on RHEL 5 you must enable a more up-to-date package repository that is provided by the owner of the Erlang package. To do this, issue the following command as 'root':

wget -O /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo[/code] 
Install (or update) Erlang (all versions)

Issue the following command as 'root':

yum install erlang


Install Erlang from Erlang Solutions or

Download and install the appropriate RPM from
Erlang Solutions.
Download and install the
esl-erlang-compat RPM (direct download) produced byJason
McIntosh.
This is needed since Erlang Solutions' packages provide "esl-erlang"; this package just requires "esl-erlang" and provides "erlang".

Install Erlang from VMware

Download and install the appropriate RPM from
VMware.

Install the Server

After downloading the server package, issue the following command as 'root':

rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc yum install rabbitmq-server-3.3.1-1.noarch.rpm

Run RabbitMQ Server

Customise RabbitMQ Environment Variables
The server should start using defaults. You can
customise the RabbitMQ environment. Also see how to
configure components.

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 runchkconfig 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).

Default user access

The broker creates a user guest with password
guest. Unconfigured clients will in general use these credentials.
By default, these credentials can only be used when connecting to the broker as localhost
so you will need to take action before connecting fromn any other machine.

See the documentation on
access control for information on how to create more users, delete the
guest user, or allow remote access to the guest user.

Managing the Broker

To stop the server or check its status, etc., you can invoke
rabbitmqctl (as an administrator). It should be available on the path. Allrabbitmqctl commands will report the node absence if no broker is running.

Invoke rabbitmqctl stop to stop the server.
Invoke rabbitmqctl status to check whether it is running.

More
info on rabbitmqctl.

Logging

Output from the server is sent to a RABBITMQ_NODENAME.log file in theRABBITMQ_LOG_BASE directory. Additional log data is written toRABBITMQ_NODENAME-sasl.log.

The broker always appends to the log files, so a complete log history is retained.

You can use the logrotate program to do all necessary rotation and compression, and you can change it. By default, this script runs weekly on files located in default/var/log/rabbitmq directory. See/etc/logrotate.d/rabbitmq-server
to configurelogrotate.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: