在linux部署hornetq为系统服务

linux系统服务的脚本文件都存放在/etc/init.d目录中,要把hornetq以系统服务方式运行,需要在/etc/init.d目录新建脚本hornetq

 

 

执行service hornetq start/stop/restart/status就可以对hornetq进行[启动/结束/重启/查看状态]操作。

 

注意:在RedHat中出现

 

原因是RedHat中默认的jdk为1.4.2,通过服务方式启动hornetq使用的是默认的jdk,而我们配置的JAVA_HOME=/usr/java/latest并没有起作用,因此需要在$HORNETQ_HOME/bin/run.sh中显式得使用/usr/java/latest/bin/java命令来代替java命令,更改后run.sh内容如下:

 

#!/bin/sh

 

JAVAHOME=/usr/java/latest

export HORNETQ_HOME=..

mkdir -p ../logs

# By default, the server is started in the non-clustered standalone configuration

 

if [ a"$1" = a ]; then CONFIG_DIR=$HORNETQ_HOME/config/stand-alone/non-clustered; else CONFIG_DIR="$1"; fi

if [ a"$2" = a ]; then FILENAME=hornetq-beans.xml; else FILENAME="$2"; fi

 

export CLASSPATH=$CONFIG_DIR:$HORNETQ_HOME/schemas/

#you can use the following line if you want to run with different ports

#export CLUSTER_PROPS="-Djnp.port=1099 -Djnp.rmiPort=1098 -Djnp.host=localhost -Dhornetq.remoting.netty.host=localhost -Dhornetq.remoting.netty.port=5445"

export JVM_ARGS="$CLUSTER_PROPS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=$CONFIG_DIR -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Djava.library.path=."

#export JVM_ARGS="-Xmx512M -Djava.util.logging.config.file=$CONFIG_DIR/logging.properties -Dhornetq.config.dir=$CONFIG_DIR -Djava.library.path=. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"

 

for i in `ls $HORNETQ_HOME/lib/*.jar`; do

        CLASSPATH=$i:$CLASSPATH

done

 

echo "***********************************************************************************"

echo "java $JVM_ARGS -classpath $CLASSPATH org.hornetq.integration.bootstrap.HornetQBootstrapServer $FILENAME"

echo "***********************************************************************************"

$JAVAHOME/bin/java $JVM_ARGS -classpath $CLASSPATH -Dcom.sun.management.jmxremote org.hornetq.integration.bootstrap.HornetQBootstrapServer $FILENAME

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值