2014-01-22 23 views
0

我正在實施複製的leveldb activemq設置。我有3個在同一個盒子上運行的activemq實例。我在配置文件中更改rmiPort,amqpport和openwire端口。Activemq關閉失敗,然後殺死進程

配置像lookslie這樣:

<?xml version="1.0" encoding="UTF-8"?><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.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.conf}/credentials.properties</value> 
    </property> 
</bean> 


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


    <destinationPolicy> 
     <policyMap> 
      <policyEntries> 
      <policyEntry producerFlowControl="false" topic="&gt;"> 
       <!-- The constantPendingMessageLimitStrategy is used to prevent 
        slow topic consumers to block producers and affect other consumers 
        by limiting the number of messages that are retained 
        For more information, see: 
        http://activemq.apache.org/slow-consumer-handling.html 

       --> 
       <pendingMessageLimitStrategy> 
       <constantPendingMessageLimitStrategy limit="1000"/> 
       </pendingMessageLimitStrategy> 
      </policyEntry> 
      <policyEntry producerFlowControl="false" queue="&gt;"> 
       <deadLetterStrategy> 
            <!-- 
             Use the prifix 'DLQ.' for the destination name, and make the DLQ a queue rather than a topic 
            --> 
            <individualDeadLetterStrategy queuePrefix="DLQ." useQueueForQueueMessages="true"/> 
           </deadLetterStrategy> 
       <!-- Use VM cursor for better latency 
        For more information, see: 

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

       <pendingQueuePolicy> 
       <vmQueueCursor/> 
       </pendingQueuePolicy> 
       --> 
      </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> 


    <persistenceAdapter> 
     <replicatedLevelDB bind="tcp://0.0.0.0:0" directory="${activemq.data}/leveldb" replicas="3" zkAddress="gwxdev05.northamerica.cerner.net:2181,gwxdev05.northamerica.cerner.net:2182,gwxdev05.northamerica.cerner.net:2183" zkPassword="password" zkPath="/opt/gwx/activemqdata"/> 
    </persistenceAdapter> 



      <systemUsage> 
     <systemUsage sendFailIfNoSpace="true"> 
      <memoryUsage> 
       <memoryUsage limit="256 mb"/> 
      </memoryUsage> 
      <storeUsage> 
       <storeUsage limit="1 gb"/> 
      </storeUsage> 
      <tempUsage> 
       <tempUsage limit="128 mb"/> 
      </tempUsage> 
     </systemUsage> 
    </systemUsage> 


    <transportConnectors> 
     <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --> 
     <transportConnector name="openwire" uri="tcp://0.0.0.0:${openwirePort}?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/> 
     <transportConnector name="amqp" uri="amqp://0.0.0.0:${amqpPort}?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/> 
    </transportConnectors> 

    <!-- destroy the spring context on shutdown to stop jetty --> 
    <shutdownHooks> 
     <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook"/> 
    </shutdownHooks> 

</broker> 


<import resource="jetty.xml"/> 

我的實例文件看起來像這樣:

ACTIVEMQ_BASE=`cd "$ACTIVEMQ_BASE" && pwd` 

## Add system properties for this instance here (if needed), e.g 
#export ACTIVEMQ_OPTS_MEMORY="-Xms256M -Xmx1G" 
#export ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY 
-Dorg.apache.activemq.UseDedicatedTaskRunner=true 
-Djava.util.logging.config.file=logging.properties" 

export ACTIVEMQ_SUNJMX_CONTROL="-Dactivemq.jmx.url=service:jmx:rmi:///jndi/rmi://127.0.0.1:8100/jmxrmi" 
# 
ACTIVEMQ_SUNJMX_START="-Dcom.sun.management.jmxremote.port=8100 " 
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.authenticate=false" 
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false" 


export ACTIVEMQ_SUNJMX_START=$ACTIVEMQ_SUNJMX_START 
export ACTIVEMQ_HOME=/opt/gwx/apache-activemq-5.10-SNAPSHOT 
export ACTIVEMQ_BASE=$ACTIVEMQ_BASE 

    export JAVA_HOME=/opt/gwx/apache-activemq-5.10-SNAPSHOT/jdk1.7.0_25 

    ${ACTIVEMQ_HOME}/bin/activemq "[email protected]" 

這裏是例外,我得到:

Connecting to pid: 2410 
INFO: failed to resolve jmxUrl for pid:2410, using default JMX url Connecting to JMX URL: service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi 
ERROR: java.lang.RuntimeException: Failed to execute stop task. Reason: java.io.IOException: Failed to retrieve RMIServer stub: 
javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:  java.net.ConnectException: Connection refused] java.lang.RuntimeException: Failed to execute stop task. Reason: java.io.IOException: Failed to retrieve RMIServer stub: 

javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection refused] 
    at 

我檢查防火牆。它不是問題。

任何想法可能會導致此問題。

ActiveMQ的5.10版本快照

的Java 1.7

OS的Linux 6.4

+0

你檢查你的啓動日誌查看JMX端口的實際位置? –

+0

我沒有看到任何reagrding jmxport的東西。所有我看到的openwireport和amqp端口的東西。我可以使用jconsole從我的機器上使用此網址連接到activemq:service:jmx:rmi:/// jndi/rmi:// :8100/jmxrmi – cp392

+0

您認爲它與端口綁定有什麼關係?我跑了netstat。 11:02:47#netstat -lptun | grep 8100 - > output: tcp 0 0 ::: 8100 ::: * LISTEN 9810/java – cp392

回答

0

如果它仍然可以幫助別人:

當我在斌/包膜這

export ACTIVEMQ_SUNJMX_CONTROL="-Dactivemq.jmx.url=service:jmx:rmi:///jndi/rmi://127.0.0.1:8100/jmxrmi" 
# 
ACTIVEMQ_SUNJMX_START="-Dcom.sun.management.jmxremote.port=8100 " 
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.authenticate=false" 
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false" 

,它沒有工作,即使沒有日誌記錄,處理失敗。 我不知道爲什麼,但這種方法的工作原理(用於AMQ 5.13):U添加到XML的:

<managementContext> 
      <managementContext connectorPort="1099"/> 
</managementContext> 

沒有像ACTIVEMQ_SUNJMX_START在ENV文件

+1

設置managementContext不是必需的(http://activemq.apache.org/jmx.html),也不鼓勵,但是設置'ACTIVEMQ_SUNJMX_START ='爲空對我來說意味着什麼。在開始設置'ACTIVEMQ_SUNJMX_CONTROL'時,您所做的方式將使JVM能夠控制JMX,這是正確的。如果您需要正確的日誌記錄,我發現至少使用'-Dlog4j.configuration = file:// $ {ACTIVEMQ_CONF}/log4j.properties'覆蓋'ACTIVEMQ_OPTS'可以獲得更好的信息。整個設置太大,無法發表評論。 – Moreaki