activemq安装及自启动方法

参考 魔夜听剑的博客,网址:http://www.cnblogs.com/zhi-leaf/p/5932011.html

一、linux环境下

linux下载tar.gz包

之后解压:

tar -zxvf apache-activemq-5.14.1-bin.tar.gz

解压后,进入bin目录,根据linux系统版本(通过uname -a),选择启动,如linux-x86-32或者linux-x86-64

如:

cd apache-activemq-5.14.1/bin/linux-x86-64/

之后

./activemq start

即可启动

添加启动项,让其自启动

1 创建连接:

ln -sf /dev/activeMQ/apache-activemq-5.14.1/bin/linux-x86-64/activemq /etc/init.d/
update-rc.d activemq defaults

对于/dev/activeMQ/apache-activemq-5.14.1/bin/linux-x86-64/activemq中的activemq,正式文本中需要添加下面的:
#### BEGIN INIT INFO
# Provides:             activemq
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Default-Start:        2 3 4 5
# Default-Stop:         0 6
# chkconfig: 2345 64 36
# Short-Description:    ActiveMQ server
### END INIT INFO

即根据实际把上面的进行改写,亲测,无需修改上面的名称。

2 直接进行测试:

service activemq start
service activemq stop

service activemq status

添加启动项:

update-rc.d   activemq defaults  

sysv-rc-conf 进行查看该服务是否自启

之后在/etc/init.d目录增加activemq文件

cd /etc/init.d/
vi activemq

#!/bin/sh

#

# /etc/init.d/activemq

# chkconfig: 345 63 37

# description: activemq servlet container.

# processname: activemq 5.14.1

# Source function library.

#. /etc/init.d/functions

# source networking configuration.

#. /etc/sysconfig/network

 

#export JAVA_HOME=/

export CATALINA_HOME=/usr/local/activemq/apache-activemq-5.14.1

 

case $1 in

    start)

        sh $CATALINA_HOME/bin/activemq start

    ;;

    stop)

        sh $CATALINA_HOME/bin/activemq stop

    ;;

    restart)

        sh $CATALINA_HOME/bin/activemq stop

        sleep 1

        sh $CATALINA_HOME/bin/activemq start

    ;;

esac

exit 0

赋予权限:

chmod 777 activemq

设置开启    启动activemq

chkconfig activemq on
service activemq start

查看activemq状态

service activemq status

其他和关闭activemq服务

service activemq start
service activemq stop

   设置开机启动或不启动activemq服务

chkconfig activemq on
chkconfig activemq off

 

activemq修改内存信息:

/activeMQ/apache-activemq-5.14.1/bin/linux-x86-64下


wrapper.conf  中
wrapper.java.maxmemory=1024  修改为
wrapper.java.maxmemory=512

 

二、windows环境

出现端口被占用java.net.BindException: Address already in use: bind

在cmd下启动 activemq.bat > a.txt输出dada到a.txt下。日志:

......................
jvm 1    |  WARN | FAILED ServerConnector@63b4af94{HTTP/1.1}{0.0.0.0:61614}: java.net.BindException: Address already in use: bind

| java.net.BindException: Address already in use: bind

 

之后在conf/activemq.xml中

        <transportConnectors>
            <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="ws" uri="ws://0.0.0.0:61612?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        </transportConnectors>

修改重复的端口即可。例如我修改61614为61612端口。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值