Linux apache-activemq安装及配置

来源:互联网 发布:the greedy python 编辑:程序博客网 时间:2024/05/16 06:46
1.  apache-activemq安装

  备注:apache-activemq安装时JDK必须在1.5以,否则不能访问。

(1)从官网下载Activemq Linux包http://activemq.apache.org/download.html.这儿我下载的是 apache-activemq-5.4.3-bin.tar.gz

(2)解压包

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

(3)进入解压后的文件夹apache-activemq-5.4.3-bin中的bin目录

cd  apache-activemq-5.4.3-bin/bin目录

(4)在启动前先配置activemq。在bin目录下执行

./activemq  setup  /root/.activemqrc

(5)提高activemq的权限

chmod 600 /root/.activemqrc

 

(6)启动activemq

./activemq  start

 (7)最后http访问出现以下代表成功

    http://IP:61616/若出现下边内容则说明安装成功(备注在启动前主要要开启端口61616)

 

 

 

2.  apache-activemq自启动设置

                   修改启动脚本/opt/activemq/bin/activemq,将开头处改为:

#!/bin/sh

### 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

# Short-Description:    ActiveMQ server

### END INIT INFO

 

 

         然后创建软链接:

# ln -s /opt/activemq/bin/activemq /etc/init.d/

 

         然后进入系统开机自启动配置文件rc.local的编辑界面

vi  /etc/rc.local

 

         然后插入启动语句:

bash /etc/init.d/activemq start

         最后保存

 

 

3.  apache-activemq调优配置

         1.    JVM内存设置:

                   注意不要修改%ACTIVEMQ_HOME%/bin目录下activemq文件, 要改 /root/.activemqrc 文件(如果没有找到.activemqrc文件,运行一次activemq就自动生成了),找到文件中的ACTIVEMQ_OPTS_MEMORY选项,设置为:

                            ACTIVEMQ_OPTS_MEMORY="-Xms2048M -Xmx2048M"

         注意不要多余的空格。

         2.  activemq参数配置,打开%ACTIVEMQ_HOME%/confg目录下的activemq.xml文件,进行如下修改(红色部分为修改的内容)。

<!--

    Licensed to the Apache Software Foundation (ASF) under one or more

    contributor license agreements.  See the NOTICE file distributed with

    this work for additional information regarding copyright ownership.

    The ASF licenses this file to You under the Apache License, Version 2.0

    (the "License"); you may not use this file except in compliance with

    the License.  You may obtain a copy of the License at

  

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software

    distributed under the License is distributed on an "AS IS" BASIS,

    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

    See the License for the specific language governing permissions and

    limitations under the License.

-->

<!-- START SNIPPET: example -->

<beans

  xmlns="http://www.springframework.org/schema/beans"

  xmlns:amq="http://activemq.apache.org/schema/core"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <!-- Allows us to use system properties as variables in this configuration file -->

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

        <property name="locations">

            <value>file:${activemq.base}/conf/credentials.properties</value>

        </property>     

    </bean>

    <!--

        The <broker> element is used to configure the ActiveMQ broker.

    -->

    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.base}/data" destroyApplicationContextOnStop="true">

        <!--

            For better performances use VM cursor and small memory limit.

            For more information, see:

            http://activemq.apache.org/message-cursors.html

            Also, if your producer is "hanging", it's probably due to producer flow control.

            For more information, see:

            http://activemq.apache.org/producer-flow-control.html

        -->

        <destinationPolicy>

            <policyMap>

              <policyEntries>

                <policyEntry topic=">" producerFlowControl="true" memoryLimit="200mb">

                  <pendingSubscriberPolicy>

                    <vmCursor />

                  </pendingSubscriberPolicy>

                </policyEntry>

                <policyEntry queue=">" producerFlowControl="true" memoryLimit="200mb">

                </policyEntry>

              </policyEntries>

            </policyMap>

        </destinationPolicy>

        <!--

            The managementContext is used to configure how ActiveMQ is exposed in

            JMX. By default, ActiveMQ uses the MBean server that is started by

            the JVM. For more information, see:

            http://activemq.apache.org/jmx.html

        -->

        <managementContext>

            <managementContext createConnector="false"/>

        </managementContext>

        <!--

            Configure message persistence for the broker. The default persistence

            mechanism is the KahaDB store (identified by the kahaDB tag).

            For more information, see:

            http://activemq.apache.org/persistence.html

        -->

        <persistenceAdapter>

            <kahaDB directory="${activemq.base}/data/kahadb"/>

        </persistenceAdapter>

          <!--

            The systemUsage controls the maximum amount of space the broker will

            use before slowing down producers. For more information, see:

            http://activemq.apache.org/producer-flow-control.html

           -->

        <systemUsage>

            <systemUsage>

                <memoryUsage>

                    <memoryUsage limit="100 mb"/>  /////////////////修改/////////////////

                </memoryUsage>

                <storeUsage>

                    <storeUsage limit="4 gb"/>      ///////////////修改添加//////////////////////

                </storeUsage>

                <tempUsage>

                    <tempUsage limit="600 mb"/>   //////////////修改添加///////////////////////

                </tempUsage>

            </systemUsage>

        </systemUsage>

                   <!-- -->

        <!--

            The transport connectors expose ActiveMQ over a given protocol to

            clients and other brokers. For more information, see:

            http://activemq.apache.org/configuring-transports.html

        -->

        <transportConnectors>

            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>

        </transportConnectors>

    </broker>

    <!--

        Enable web consoles, REST and Ajax APIs and demos

        Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details

    -->

    <import resource="jetty.xml"/>

</beans>

<!-- END SNIPPET: example -->

查看开机启动项

ps -ef |grep Java

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 支付宝转帐到已停机的号码上怎么办 支付宝充话费充错号码怎么办 支付宝话费充错号码了怎么办 村书记打了人不给赔偿药费怎么办 淘宝退给的支付的钱怎么办 淘宝支付了钱没回信息怎么办 微信话费充值暂时缺货怎么办 天猫过敏无忧不给退款怎么办 顺丰快递指定丰巢柜发现柜满怎么办 阿里购物申请退款过期末退怎么办 韵达签收了发现里面东西丢了怎么办 没有收到快递但是显示签收了怎么办 支付宝充话费显示商家未发货怎么办 快递被买家签收后调包了怎么办 快递买家签收了东西坏了怎么办 快递没签收到买家评价了怎么办 快递买家签收后现在要退货怎么办 支付宝充话费充错对方关机怎么办 闲鱼同意退款了买家不退东西怎么办 被骗了说给存q币怎么办 方正说我的淘宝字体侵权怎么办 买家说收到衣服没有吊牌该怎么办 淘宝下完订单店主不发货怎么办 工商局不给查被告企业的信息怎么办 被职业打假人起诉到法院怎么办 京东购物如果换货不给你发货怎么办 淘宝上发的快递没有了怎么办 天猫购物半个月不发货怎么办 京东网同一产品购买多规格的怎么办 天猫商城购买的家具要退换货怎么办 亚马逊美国站会员日前没销量怎么办 淘宝买的鞋子把脚磨坏了怎么办 拼多多下单 没货 没法发货怎么办 闲鱼退货物流弄坏了卖家拒收怎么办 客户说物流太慢了 要退货怎么办 京东退货物流系统不更新怎么办 把货交给物流但是物流丢货了怎么办 货还在物流就申请退款怎么办 荣耀4x返回键不管用怎么办 华为手机关不了机也开不了机怎么办 荣耀畅玩5x手机密码忘了怎么办