RabbmitMQ单点配置

一、准备工作 1.配置yum源   

mount -t cifs -o username=chen.bo@ctrip.com  //192.168.83.1/share1/ /mnt  

mount /mnt/rhel-5.4-server-i386-dvd.iso /yum/ -o loop  

mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bak   

vim /etc/yum.repos.d/local.repo

[server]

name=server

baseurl=file:///yum/Server 

enabled=1

gpgcheck=0

[cluster]

name=cluster

baseurl=file:///yum/Cluster

enabled=1

gpgcheck=0

[clusterstorage]

name=clusterstorage

baseurl=file:///yum/ClusterStorage

enabled=1

gpgcheck=0

[vt]

name=vt

baseurl=file:///yum/VT

enabled=1

gpgcheck=0

#yum clean all --清除缓存和之前yum的一些信息  

#yum list    --能够把所有的包都列出来就表示成功

2.安装

yum install unixODBC  unixODBC-devel

二、安装xmlto   

$ tar zxvf xmlto-0.0.23.tar.gz   

$ cd xmlto-0.0.23   

$ ./configure   

$ make && make install  

三、Erlang安装与测试   

$ tar zxvf otp_src_17.0.tar.gz   

$ cd otp_src_17.0   

$ ./configure --prefix=/home/erlang   

$ make && make install   

$ vim /etc/profile     

export PATH=$PATH:/home/erlang/bin   

$ source /etc/profile   

$ erl   

$ erl > EvenN = lists:filter (fun (N) -> N rem 2 == 0 end, lists:seq (1,100)).   

$ erl > halt().

四、安装 python(2.4.3)略 simplejson(2.2.1)       

$ tar zxvf simplejson-2.2.1.tar.gz   

$ cd simplejson-2.2.1   

$ python setup.py install

五、安装 rabbitmq-server(3.3.3)    

$ tar xvzf rabbitmq-server-3.3.3.tar.gz    

$ cd rabbitmq-server-3.3.3    

$ make   -- make USE_SPECS=false       注:在未连网的服务器上,需要将Makefile 里 'xmlto' 替换为 ' xmlto --skip-validation '    

$ TARGET_DIR=/usr/local/rabbitmq SBIN_DIR=/usr/local/rabbitmq/sbin MAN_DIR=/usr/local/rabbitmq/man

DOC_INSTALL_DIR=/usr/local/rabbitmq/doc make install

六、启动并测试    

$ cd /usr/local/rabbitmq/sbin    

$  /usr/local/rabbitmq/sbin/rabbitmq-server     --查看进程 lsof -i:5672    注意机器名/etc/hosts要指定本机IP    

$  /usr/local/rabbitmq/sbin/rabbitmqctl stop    

$  service iptables stop    

$  rabbitmq-plugins enable rabbitmq_management  /* 开启管理后台 */ 

$ mkdir /etc/rabbitmq   chmod 777 /etc/rabbitmq    

 

添加用户    

$  rabbitmqctl add_vhost statuscheckvhost    

$  rabbitmqctl add_user heartbeat alive    

$  rabbitmqctl set_permissions -p statuscheckvhost heartbeat ".*" ".*" ".*"    

$  rabbitmqctl set_user_tags heartbeat management        http://192.168.83.129:15672/   heartbeat alive登录管理后台      

  clientAPI连接: var bus = RabbitHutch.CreateBus

("host=192.168.83.129;virtualHost=statuscheckvhost;username=heartbeat;password=alive")    

采用订阅与发布,简单测试,先关闭防火墙     

默认路径: /var/log/rabbitmq    /var/lib/rabbitmq   /etc/rabbitmq/rabbitmq.conf     /usr/local/rabbitmq

七、配置    

1. /etc/rabbitmq/rabbitmq-env.conf 环境变量 /* define ports, file locations and names  */    

RABBITMQ_NODE_IP_ADDRESS=    

RABBITMQ_NODE_PORT=5672    

RABBITMQ_DIST_PORT    

RABBITMQ_NODENAME    

RABBITMQ_SERVICENAME    

RABBITMQ_CONSOLE_LOG    

RABBITMQ_CTL_ERL_ARGS    

RABBITMQ_SERVER_ERL_ARGS    

RABBITMQ_SERVER_START_ARGS    

2./etc/rabbitmq/rabbitmq.conf 参数配置 /* server component settings for permissions, limits and clusters, and also plugin

settings.*/

settings.*/

 

客户端调用代码

posted @ 2015-02-11 14:57  bobsoft  阅读(554)  评论(0编辑  收藏  举报