【问题标题】:How to set the default activemq 5.10.0 configuration file?如何设置默认的activemq 5.10.0配置文件?
【发布时间】:2015-06-23 14:30:37
【问题描述】:

你好,

希望正确配置我的 apache activemq 我的 Ubuntu 我遵循了来自

的教程

http://servicebus.blogspot.com/2011/02/installing-apache-active-mq-on-ubuntu.html

一切正常,我启动了代理并停止了它。现在我试着用

重新开始
sudo /etc/init.d/activemq start 

然后我有这个输出

INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties       to get details
INFO: changing to user 'leo' to invoke java
INFO: pidfile created : '/opt/activemq/data/activemq-leo-Aspire-5742G.pid' (pid '22579')

跑步

sudo /etc/init.d/activemq status

我明白了

INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/bin/java'
ActiveMQ not running

我真正觉得奇怪的是,当我搬到

/opt/apache-activemq-5.10.0

并发出命令

./activemq start 

返回

ERROR: There are syntax errors in '/etc/default/activemq'

所以我删除了 /etc/default/activemq 文件并再次运行 ./activemq start 并在这里再次运行。

    INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq     /home/leo/.activemqrc)

INFO: Invoke the following command to create a configuration file
./activemq setup [ /etc/default/activemq | /home/leo/.activemqrc ]

INFO: Using java '/usr/bin/java'
INFO: Process with pid '22810' is already running

以下是我目前错误的配置文件。我应该如何配置配置文件?

    # ------------------------------------------------------------------------
    # Configuration file for running Apache Active MQ as standalone provider
    #
    # This file overwrites the predefined settings of the sysv init-script
    #
    # Active MQ installation dir
    if [ -z "$ACTIVEMQ_HOME" ] ; then
    # try to find ACTIVEMQ
    if [ -d /opt/activemq ] ; then
    ACTIVEMQ_HOME=/opt/activemq
    fi

    if [ -d "${HOME}/opt/activemq" ] ; then
    ACTIVEMQ_HOME="${HOME}/opt/activemq"
    fi

    ## resolve links - $0 may be a link to activemq's home
    PRG="$0"
    progname=`basename "$0"`
    saveddir=`pwd`

    # need this for relative symlinks
    dirname_prg=`dirname "$PRG"`
    cd "$dirname_prg"

    while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> (.*)$'`
    if expr "$link" : '.*/.*' > /dev/null; then
    PRG="$link"
    else
    PRG=`dirname "$PRG"`"/$link"
    fi
    done

    ACTIVEMQ_HOME=`dirname "$PRG"`/..

    cd "$saveddir"

    # make it fully qualified
    ACTIVEMQ_HOME=`cd "$ACTIVEMQ_HOME" && pwd`
    fi

    if [ -z "$ACTIVEMQ_BASE" ] ; then
    ACTIVEMQ_BASE="$ACTIVEMQ_HOME"
    fi

    # Active MQ configuration directory
    if [ -z "$ACTIVEMQ_CONF" ] ; then

    # For backwards compat with old variables we let ACTIVEMQ_CONFIG_DIR set ACTIVEMQ_CONF
    if [ -z "$ACTIVEMQ_CONFIG_DIR" ] ; then
    ACTIVEMQ_CONF="$ACTIVEMQ_BASE/conf"
    else
    ACTIVEMQ_CONF="$ACTIVEMQ_CONFIG_DIR"
    fi
    fi

    # Configure a user with non root priviledges, if no user is specified do not change user
    if [ -z "$ACTIVEMQ_USER" ] ; then
    ACTIVEMQ_USER="leo"
    fi

    # Active MQ data directory
   if [ -z "$ACTIVEMQ_DATA" ] ; then

    # For backwards compat with old variables we let ACTIVEMQ_DATA_DIR set ACTIVEMQ_DATA
    if [ -z "$ACTIVEMQ_DATA_DIR" ] ; then
    ACTIVEMQ_DATA="$ACTIVEMQ_BASE/data"
    else
    ACTIVEMQ_DATA="$ACTIVEMQ_DATA_DIR"
    fi
    fi

    if [ -z "$ACTIVEMQ_TMP" ] ; then
    ACTIVEMQ_TMP="$ACTIVEMQ_BASE/tmp"
    fi

    setCurrentUser(){
    CUSER=`whoami 2>/dev/null`

    # Solaris fix
    if [ ! $? -eq 0 ]; then
    CUSER=`/usr/ucb/whoami 2>/dev/null`
    fi
    }

    if [ ! -d "$ACTIVEMQ_DATA" ]; then
    setCurrentUser
    if ( [ -z "$ACTIVEMQ_USER" ] || [ "$ACTIVEMQ_USER" = "$CUSER" ] );then
    mkdir $ACTIVEMQ_DATA
    elif [ "`id -u`" = "0" ];then
    su -c "mkdir $ACTIVEMQ_DATA" - $ACTIVEMQ_USER;
    fi
    fi

    # Location of the pidfile
    if [ -z "$ACTIVEMQ_PIDFILE" ]; then
    ACTIVEMQ_PIDFILE="$ACTIVEMQ_DATA/activemq-`hostname`.pid"
    fi

    # Location of the java installation
    # Specify the location of your java installation using JAVA_HOME, or specify the
    # path to the "java" binary using JAVACMD
    # (set JAVACMD to "auto" for automatic detection)
    #JAVA_HOME=""
    JAVACMD="auto"

    # Set jvm memory configuration
    if [ -z "$ACTIVEMQ_OPTS_MEMORY" ] ; then
    ACTIVEMQ_OPTS_MEMORY="-Xms1G -Xmx1G"
    fi

    # Uncomment to enable audit logging
    #ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS -Dorg.apache.activemq.audit=true"

    # Set jvm jmx configuration
    # This enables jmx access over a configured jmx-tcp-port.
    # You have to configure the first four settings if you run a ibm jvm, caused by the
    # fact that IBM's jvm does not support VirtualMachine.attach(PID).
    # JMX access is needed for quering a running activemq instance to gain data or to
    # trigger management operations.
    #
    # Example for ${ACTIVEMQ_CONF}/jmx.access:
    # ---
    # # The "monitorRole" role has readonly access.
    # # The "controlRole" role has readwrite access.
    # monitorRole readonly
    # controlRole readwrite
    # ---
    #
    # Example for ${ACTIVEMQ_CONF}/jmx.password:
    # ---
    # # The "monitorRole" role has password "abc123".
    # # # The "controlRole" role has password "abcd1234".
    # monitorRole abc123
    # controlRole abcd1234
    # ---
    #
     ACTIVEMQ_SUNJMX_START="-Dcom.sun.management.jmxremote.port=11099 "
     ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -    Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password"
     ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -    Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONF}/jmx.access"
     ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false"
    ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote"

    # Set jvm jmx configuration for controlling the broker process
    # You only have to configure the first four settings if you run a ibm jvm, caused by the
    # fact that IBM's jvm does not support VirtualMachine.attach(PID)
    # (see also com.sun.management.jmxremote.port, .jmx.password.file and .jmx.access.file )
    ACTIVEMQ_SUNJMX_CONTROL="--jmxurl service:jmx:rmi:///jndi/rmi://127.0.0.1:1099/jmxrmi --    jmxuser leo --jmxpassword leo"
    #ACTIVEMQ_SUNJMX_CONTROL=""

    # Specify the queue manager URL for using "browse" option of sysv initscript
    if [ -z "$ACTIVEMQ_QUEUEMANAGERURL" ]; then
    ACTIVEMQ_QUEUEMANAGERURL="--amqurl tcp://localhost:61616"
    fi

    # Set additional JSE arguments
    ACTIVEMQ_SSL_OPTS="$SSL_OPTS"

    # Uncomment to enable YourKit profiling
    #ACTIVEMQ_DEBUG_OPTS="-agentlib:yjpagent"

    # Uncomment to enable remote debugging
    #ACTIVEMQ_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -    Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"

    # ActiveMQ tries to shutdown the broker by jmx,
    # after a specified number of seconds send SIGKILL
    if [ -z "$ACTIVEMQ_KILL_MAXSECONDS" ]; then
    ACTIVEMQ_KILL_MAXSECONDS=30
    fi

【问题讨论】:

    标签: activemq


    【解决方案1】:

    对于您的脚本,您的问题可能在这里:

    -    Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password"
    

    在 - 和 Dcom 之间使用空格。这些是 JVM 参数,在 - 和 D 之间不应有空格:

    -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password"
    

    这可能是复制和粘贴格式问题,但您提出的错误并没有太多可看的地方。确保之后的其他参数在标志和 D 之间也没有空格。

    就已经运行的进程而言,看起来您已经启动了 ActiveMQ。

    如果脚本不适合您,您可以使用以下命令来确定它是否正在运行:

    ps -ef | grep activemq
    

    如果您只是学习 ActiveMQ,我建议您关注http://activemq.apache.org/ 上的文档,而不是您关注的链接。除了该帖子中提到的内容之外,还有更多需要配置和理解的内容。如果您只是在学习,这会使事情变得比实际需要的要复杂一些。

    【讨论】:

      【解决方案2】:

      其实是因为在Using instances下的/activmq脚本中有someif else语句,如果找不到文件就重定向到默认文件,打开脚本看看

      查看这里了解更多信息

      Unix configuration

      编码愉快!

      【讨论】:

        猜你喜欢
        • 2014-12-27
        • 1970-01-01
        • 1970-01-01
        • 2021-02-01
        • 1970-01-01
        • 2020-04-15
        • 1970-01-01
        • 2019-09-20
        • 2023-01-13
        相关资源
        最近更新 更多