yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-develperlunixODBC-devel
yum install python -y
安装Erlang
- 1. 下载erlang
- 下载地址: http://download.csdn.net/detail/a15134566493/9517595
- 官方下载地址: http://erlang.org/download/otp_src_18.3.tar.gz
2.安装
#解压 tar xvf otp_src_18.3.tar.gz cd otp_src_18.3 #配置 '--prefix'指定的安装目录 ./configure --prefix=/usr/local/erlang --with-ssl -enable-threads -enable-smmp-support -enable-kernel-poll --enable-hipe --without-javac #安装 make && make install
3.配置erlang环境变量
vim /etc/profile
#在文件末尾添加下面代码 'ERLANG_HOME'等于上一步'--prefix'指定的目录 ERLANG_HOME=/usr/local/erlang PATH=$ERLANG_HOME/bin:$PATH export ERLANG_HOME export PATH #使环境变量生效 source /etc/profile #输入命令检验是否安装成功 erl #如下输出表示安装成功
安装RabbitMQ
- 1.下载RabbitMQ
- 官方下载地址 http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-generic-unix-3.6.1.tar.xz
2.安装
RabbitMQ3.6版本无需make、make install 解压就可以用
#解压rabbitmq,官方给的包是xz压缩包,所以需要使用xz命令 xz -d rabbitmq-server-generic-unix-3.6.1.tar.xz #xz解压后得到.tar包,再用tar命令解压 tar -xvf rabbitmq-server-generic-unix-3.6.1.tar #移动目录 看个人喜好 cp -rf ./rabbitmq_server-3.6.1 /usr/local/ cd /usr/local/ #修改文件夹名 mv rabbitmq_server-3.6.1 rabbitmq-3.6.1 #开启管理页面插件 cd ./rabbitmq-3.6.1/sbin/ ./rabbitmq-plugins enable rabbitmq_management
#启动命令,该命令ctrl+c后会关闭服务 ./rabbitmq-server #在后台启动Rabbit ./rabbitmq-server -detached #关闭服务 ./rabbitmqctl stop #关闭服务(kill) 找到rabbitmq服务的pid [不推荐] ps -ef|grep rabbitmq kill -9 ****
新装rabbtimq,发现死活rabbitmq起不来,提示, ERROR: epmd error for host "****": timeout (timed out establishing tcp connection) 后来google发现, https://gist.github.com/2522701 主机名和ip不匹配了,需要更改/etc/hosts 127.0.0.1 yournewhostname
#进入RabbitMQ安装目录 cd /usr/local/rabbitmq-3.6.1/sbin #添加用户 #rabbitmqctl add_user Username Password ./rabbitmqctl add_user rabbitadmin 123456 #分配用户标签 #rabbitmqctl set_user_tags User Tag #[administrator]:管理员标签 ./rabbitmqctl set_user_tags rabbitadmin administrator
其他
1.访问不了
安装完成之后如果机器有iptables,需要开放端口
vim /etc/sysconfig/iptables
#RabbitMQ -A INPUT -p tcp -m state --state NEW -m tcp --dport 15672 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 25672 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 5672 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 4369 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 5671 -j ACCEPT #RabbitMQ
RabbitMQ常用端口(摘自网络)
4369(epmd),
25672(Erlang distribution)
5672,5671(AMQP 0-9-1 without and with TLS)
15672(if management plugin is enabled)
61613,61614(if STOMP is enabled)
1883,8883(if MQTT is enabled)
2.Warning: PID file not written; -detached was passed
提示这句话暂时没处理,有空补上。
- 3.RabbitMQ压缩包.xz解压问题
- 需要安装xz软件(网上有教程,我之后也会补充)
- 如果嫌麻烦,可直接下载我解压好的包
- 下载地址: http://download.csdn.net/detail/a15134566493/9518835
有问题欢迎提建议。
注:1、有的地方说要把py版本升级到2.7,这里面并没有升级,没有问题。在安装erlang的时候./configure后面的参数要接上,不然会启动rabbitmq的时候会报ssl等错误。
2、guest/guest一般来说是无法登录的,guest必须是localhost才能登录,所以得先用命令行新增用户才能登录。
3、
1、如果写错了host (如:factory.setHost("locathost"); )报错:
Exception in thread "main" java.net.UnknownHostException: locathost
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:588)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612)
at com.aaa.test.Send.main(Send.java:19)
2、如果写错了HOST的IP(如:factory.setHost("192.168.1.10");)无此地址, 报错:
Exception in thread "main" java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:588)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612)
at com.aaatest.Send.main(Send.java:19)
3、如果写错端口PORT(如:factory.setPort(5678);) 报错:
Exception in thread "main" java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:588)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612)
at com.aaa.test.Send.main(Send.java:19)
4、如果写错用户名或者密码,报错:
Exception in thread "main" com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:338)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:590)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612)
at com.aaa.test.Send.main(Send.java:19)
转:http://blog.csdn.net/a15134566493/article/details/51393955