rabbitmq 安装配置

1、下载


erlang,地址:

http://www.erlang.org/download/otp_src_18.1.tar.gz

或者

https://www.erlang-solutions.com/resources/download.html

rabbitmq,地址:https://www.rabbitmq.com/releases/rabbitmq-server/v3.5.5/rabbitmq-server-3.5.5.tar.gz


2、安装所需要的服务


yum install ncurses-devel

yum install -y epel-release

yum -y install make ncurses-devel gcc gcc-c++ unixODBC unixODBC-devel openssl openssl-devel

yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel

yum -y install libxslt

yum -y install xmlto


3、安装erlang。


wget http://www.erlang.org/download/otp_src_18.1.tar.gz

tar -zxf otp_src_18.1

cd otp_src_18.1

./configure --prefix=/soft/erlang18.1 --with-ssl --enable-threads --enable-smp-support --enable-kernel-poll --enable-hipe

make

make install


#配置环境变量

vi /etc/profile

export ERL_HOME=/soft/otp_src_18.1

export PATH=$PATH:$ERL_HOME/bin

source /etc/profile


4、安装rabbitmq


wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.5.5/rabbitmq-server-generic-unix-3.5.5.tar.gz

tar -zxf rabbitmq_server-3.5.5

cd rabbitmq_server-3.5.5

make TARGET_DIR=/soft/rabbitmq3.5.5 SBIN_DIR=/soft/rabbitmq3.5.5/sbin MAN_DIR=/soft/rabbitmq3.5.5/man install

注意:解压后的目录和安装目录需要不一致


5、修改rabbitmq配置


#mkdir /etc/rabbitmq

#vi /etc/rabbitmq/rabbitmq-env.conf


//rabbitmq-env.conf的内容,后面的注释需要删除

RABBITMQ_NODE_PORT=5672    //端口号

HOSTNAME=

RABBITMQ_NODENAME=mq

RABBITMQ_CONFIG_FILE=        //配置文件的路径,可删除该行,使用默认配置

RABBITMQ_MNESIA_BASE=/data/rabbitmq/data        //需要使用的MNESIA数据库的路径

RABBITMQ_LOG_BASE=/data/logs/rabbitmq/log        //log的路径

RABBITMQ_PLUGINS_DIR=/soft/rabbitmq3.5.5/plugins    //插件的路径


5、创建管理员和用户


#cd sbin

./rabbitmqctl add_user  admin  password

./rabbitmqctl set_user_tags admin administrator  

./rabbitmqctl add_user sys@monitor  sys12@Smart

./rabbitmqctl set_user_tags sys@monitor  administrator  

//为用户赋权限:

./rabbitmqctl  set_permissions -p /  admin '.*' '.*' '.*'  

./rabbitmqctl  set_permissions -p /  sys@monitor  '.*' '.*' '.*'  


//修改密码

./rabbitmqctl  change_password admin 123456

6、启用插件服务


//启用web控制台

rabbitmq-plugins enable rabbitmq_management

//启用MQTT

rabbitmq-plugins enable rabbitmq_mqtt


//查看管理端口有没有启动:

# netstat -tnlp|grep 5672


//查看cookie文件

find / -name ".erlang*" -print

//复制cookie文件

scp .erlang.cookie [email protected]:/root

7、修改主机名和hosts文件,添加集群机器的IP到hosts文件中,并重启服务器


192.168.152.135 rabbitmq1

192.168.152.136 rabbitmq2

192.168.152.137 rabbitmq3


你可能感兴趣的:(rabbitmq 安装配置)