Repository: incubator-rocketmq Updated Branches: refs/heads/master e343f30e9 -> 913bd9b44
Export bin directory. reviewed by @yukong @vongosling Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/commit/913bd9b4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/tree/913bd9b4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/diff/913bd9b4 Branch: refs/heads/master Commit: 913bd9b446099370552d1e9a161820369ebb969b Parents: e343f30 Author: vintagewang <[email protected]> Authored: Mon Dec 19 19:59:58 2016 +0800 Committer: vintagewang <[email protected]> Committed: Mon Dec 19 19:59:58 2016 +0800 ---------------------------------------------------------------------- bin/README.md | 34 ++++++++++++++++++++++ bin/cachedog.sh | 42 +++++++++++++++++++++++++++ bin/cleancache.sh | 20 +++++++++++++ bin/cleancache.v1.sh | 40 ++++++++++++++++++++++++++ bin/mqadmin | 45 +++++++++++++++++++++++++++++ bin/mqadmin.exe | Bin 0 -> 456704 bytes bin/mqadmin.xml | 43 ++++++++++++++++++++++++++++ bin/mqbroker | 47 ++++++++++++++++++++++++++++++ bin/mqbroker.exe | Bin 0 -> 456704 bytes bin/mqbroker.numanode0 | 47 ++++++++++++++++++++++++++++++ bin/mqbroker.numanode1 | 47 ++++++++++++++++++++++++++++++ bin/mqbroker.numanode2 | 47 ++++++++++++++++++++++++++++++ bin/mqbroker.numanode3 | 47 ++++++++++++++++++++++++++++++ bin/mqbroker.xml | 43 ++++++++++++++++++++++++++++ bin/mqfiltersrv | 45 +++++++++++++++++++++++++++++ bin/mqfiltersrv.exe | Bin 0 -> 456704 bytes bin/mqfiltersrv.xml | 43 ++++++++++++++++++++++++++++ bin/mqnamesrv | 45 +++++++++++++++++++++++++++++ bin/mqnamesrv.exe | Bin 0 -> 456704 bytes bin/mqnamesrv.xml | 43 ++++++++++++++++++++++++++++ bin/mqshutdown | 49 +++++++++++++++++++++++++++++++ bin/os.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++ bin/play.sh | 33 +++++++++++++++++++++ bin/runbroker.sh | 61 +++++++++++++++++++++++++++++++++++++++ bin/runserver.sh | 48 +++++++++++++++++++++++++++++++ bin/setcache.sh | 40 ++++++++++++++++++++++++++ bin/startfsrv.sh | 45 +++++++++++++++++++++++++++++ bin/tools.sh | 43 ++++++++++++++++++++++++++++ 28 files changed, 1065 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/README.md ---------------------------------------------------------------------- diff --git a/bin/README.md b/bin/README.md new file mode 100644 index 0000000..58903a1 --- /dev/null +++ b/bin/README.md @@ -0,0 +1,34 @@ +### æä½ç³»ç»è°ä¼ +å¨ç产ç¯å¢é¨ç½²Brokeråï¼å¿ é¡»è¦æ§è¡os.shï¼å¯¹æä½ç³»ç»è¿è¡è°ä¼ + +**P.S: os.shåªè½æ§è¡ä¸æ¬¡ï¼éè¦sudo rootæé** + +### å¯å¨broker +* Unixå¹³å° + + `nohup sh mqbroker &` + +* Windowså¹³å°ï¼ä» æ¯æ64ä½ï¼ + + `mqbroker.exe` + +### å ³ébroker + sh mqshutdown broker + +### å¯å¨Name Server +* Unixå¹³å° + + `nohup sh mqnamesrv &` + +* Windowså¹³å°ï¼ä» æ¯æ64ä½ï¼ + + `mqnamesrv.exe` + +### å ³éName Server + sh mqshutdown namesrv + +### æ´æ°æå建Topic + sh mqadmin updateTopic -b 127.0.0.1:10911 -t TopicA + +### æ´æ°æå建订é ç» + sh mqadmin updateSubGroup -b 127.0.0.1:10911 -g SubGroupA \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/cachedog.sh ---------------------------------------------------------------------- diff --git a/bin/cachedog.sh b/bin/cachedog.sh new file mode 100644 index 0000000..049a663 --- /dev/null +++ b/bin/cachedog.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# 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. + +export PATH=$PATH:/sbin + +while true; do + nr_free_pages=`fgrep -A 10 Normal /proc/zoneinfo |grep nr_free_pages |awk -F ' ' '{print $2}'` + high=`fgrep -A 10 Normal /proc/zoneinfo |grep high |awk -F ' ' '{print $2}'` + + NOW_DATE=`date +%D` + NOW_TIME=`date +%T` + + if [ ${nr_free_pages} -le ${high} ]; then + sysctl -w vm.drop_caches=3 + nr_free_pages_new=`fgrep -A 10 Normal /proc/zoneinfo |grep nr_free_pages |awk -F ' ' '{print $2}'` + + printf "%s %s [CLEAN] nr_free_pages < high, clean cache. nr_free_pages=%s ====> nr_free_pages=%s\n" "${NOW_DATE}" "${NOW_TIME}" ${nr_free_pages} ${nr_free_pages_new} + + sysctl -w vm.drop_caches=1 + echo + echo + echo + else + printf "%s %s [NOTHING] nr_free_pages=%s high=%s\n" "${NOW_DATE}" "${NOW_TIME}" ${nr_free_pages} ${high} + fi + + sleep 1 +done http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/cleancache.sh ---------------------------------------------------------------------- diff --git a/bin/cleancache.sh b/bin/cleancache.sh new file mode 100644 index 0000000..250a46b --- /dev/null +++ b/bin/cleancache.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# 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. + +export PATH=$PATH:/sbin + +sysctl -w vm.drop_caches=3 http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/cleancache.v1.sh ---------------------------------------------------------------------- diff --git a/bin/cleancache.v1.sh b/bin/cleancache.v1.sh new file mode 100644 index 0000000..2e21582 --- /dev/null +++ b/bin/cleancache.v1.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# 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. + +export PATH=$PATH:/sbin + +# +# GB +# +function changeFreeCache() +{ + EXTRA=$1 + MIN=$2 + sysctl -w vm.extra_free_kbytes=${EXTRA}000000 + sysctl -w vm.min_free_kbytes=${MIN}000000 +} + + +if [ $# -ne 1 ] +then + echo "Usage: $0 freecache(GB)" + echo "Example: $0 15" + exit +fi + +changeFreeCache 3 $1 +changeFreeCache 3 1 http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqadmin ---------------------------------------------------------------------- diff --git a/bin/mqadmin b/bin/mqadmin new file mode 100644 index 0000000..616dc6d --- /dev/null +++ b/bin/mqadmin @@ -0,0 +1,45 @@ +#!/bin/sh + +# 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. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + 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 + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/tools.sh com.alibaba.rocketmq.tools.command.MQAdminStartup $@ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqadmin.exe ---------------------------------------------------------------------- diff --git a/bin/mqadmin.exe b/bin/mqadmin.exe new file mode 100644 index 0000000..e8d8fac Binary files /dev/null and b/bin/mqadmin.exe differ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqadmin.xml ---------------------------------------------------------------------- diff --git a/bin/mqadmin.xml b/bin/mqadmin.xml new file mode 100644 index 0000000..3f01808 --- /dev/null +++ b/bin/mqadmin.xml @@ -0,0 +1,43 @@ +<!-- + 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. + --> + +<java> + <debug>false</debug> + + <javahome>${JAVA_HOME}</javahome> + + <jvmtype>server</jvmtype> + + <mainclass>com.alibaba.rocketmq.tools.command.MQAdminStartup</mainclass> + + <properties> + <java.ext.dirs>${cpd}/../lib</java.ext.dirs> + <rocketmq.home.dir>${cpd}/..</rocketmq.home.dir> + </properties> + + <classpaths> + </classpaths> + + <options> + <-Xms512m></-Xms512m> + <-Xmx1g></-Xmx1g> + <-XX:NewSize>256M</-XX:NewSize> + <-XX:MaxNewSize>512M</-XX:MaxNewSize> + <-XX:PermSize>128M</-XX:PermSize> + <-XX:MaxPermSize>128M</-XX:MaxPermSize> + </options> +</java> http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqbroker ---------------------------------------------------------------------- diff --git a/bin/mqbroker b/bin/mqbroker new file mode 100644 index 0000000..d474254 --- /dev/null +++ b/bin/mqbroker @@ -0,0 +1,47 @@ +#!/bin/sh + +# 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. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + 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 + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +rm -f $HOME/rmq_bk_gc.log.bac +cp $HOME/rmq_bk_gc.log $HOME/rmq_bk_gc.log.bac +sh ${ROCKETMQ_HOME}/bin/runbroker.sh com.alibaba.rocketmq.broker.BrokerStartup $@ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqbroker.exe ---------------------------------------------------------------------- diff --git a/bin/mqbroker.exe b/bin/mqbroker.exe new file mode 100644 index 0000000..e8d8fac Binary files /dev/null and b/bin/mqbroker.exe differ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqbroker.numanode0 ---------------------------------------------------------------------- diff --git a/bin/mqbroker.numanode0 b/bin/mqbroker.numanode0 new file mode 100644 index 0000000..d0688a0 --- /dev/null +++ b/bin/mqbroker.numanode0 @@ -0,0 +1,47 @@ +#!/bin/sh + +# 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. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + 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 + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=0 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqbroker.numanode1 ---------------------------------------------------------------------- diff --git a/bin/mqbroker.numanode1 b/bin/mqbroker.numanode1 new file mode 100644 index 0000000..ee350d4 --- /dev/null +++ b/bin/mqbroker.numanode1 @@ -0,0 +1,47 @@ +#!/bin/sh + +# 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. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + 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 + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=1 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqbroker.numanode2 ---------------------------------------------------------------------- diff --git a/bin/mqbroker.numanode2 b/bin/mqbroker.numanode2 new file mode 100644 index 0000000..4ff2274 --- /dev/null +++ b/bin/mqbroker.numanode2 @@ -0,0 +1,47 @@ +#!/bin/sh + +# 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. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + 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 + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=2 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqbroker.numanode3 ---------------------------------------------------------------------- diff --git a/bin/mqbroker.numanode3 b/bin/mqbroker.numanode3 new file mode 100644 index 0000000..6c91d53 --- /dev/null +++ b/bin/mqbroker.numanode3 @@ -0,0 +1,47 @@ +#!/bin/sh + +# 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. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + 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 + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +export RMQ_NUMA_NODE=3 + +sh ${ROCKETMQ_HOME}/bin/mqbroker $@ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqbroker.xml ---------------------------------------------------------------------- diff --git a/bin/mqbroker.xml b/bin/mqbroker.xml new file mode 100644 index 0000000..f0254d3 --- /dev/null +++ b/bin/mqbroker.xml @@ -0,0 +1,43 @@ +<!-- + 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. + --> + +<java> + <debug>false</debug> + + <javahome>${JAVA_HOME}</javahome> + + <jvmtype>server</jvmtype> + + <mainclass>com.alibaba.rocketmq.broker.BrokerStartup</mainclass> + + <properties> + <java.ext.dirs>${cpd}/../lib</java.ext.dirs> + <rocketmq.home.dir>${cpd}/..</rocketmq.home.dir> + </properties> + + <classpaths> + </classpaths> + + <options> + <-Xms512m></-Xms512m> + <-Xmx1g></-Xmx1g> + <-XX:NewSize>256M</-XX:NewSize> + <-XX:MaxNewSize>512M</-XX:MaxNewSize> + <-XX:PermSize>128M</-XX:PermSize> + <-XX:MaxPermSize>128M</-XX:MaxPermSize> + </options> +</java> http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqfiltersrv ---------------------------------------------------------------------- diff --git a/bin/mqfiltersrv b/bin/mqfiltersrv new file mode 100644 index 0000000..69fc635 --- /dev/null +++ b/bin/mqfiltersrv @@ -0,0 +1,45 @@ +#!/bin/sh + +# 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. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + 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 + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runserver.sh com.alibaba.rocketmq.filtersrv.FiltersrvStartup $@ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqfiltersrv.exe ---------------------------------------------------------------------- diff --git a/bin/mqfiltersrv.exe b/bin/mqfiltersrv.exe new file mode 100644 index 0000000..e8d8fac Binary files /dev/null and b/bin/mqfiltersrv.exe differ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqfiltersrv.xml ---------------------------------------------------------------------- diff --git a/bin/mqfiltersrv.xml b/bin/mqfiltersrv.xml new file mode 100644 index 0000000..0e391d2 --- /dev/null +++ b/bin/mqfiltersrv.xml @@ -0,0 +1,43 @@ +<!-- + 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. + --> + +<java> + <debug>false</debug> + + <javahome>${JAVA_HOME}</javahome> + + <jvmtype>server</jvmtype> + + <mainclass>com.alibaba.rocketmq.filtersrv.FiltersrvStartup</mainclass> + + <properties> + <java.ext.dirs>${cpd}/../lib</java.ext.dirs> + <rocketmq.home.dir>${cpd}/..</rocketmq.home.dir> + </properties> + + <classpaths> + </classpaths> + + <options> + <-Xms512m></-Xms512m> + <-Xmx1g></-Xmx1g> + <-XX:NewSize>256M</-XX:NewSize> + <-XX:MaxNewSize>512M</-XX:MaxNewSize> + <-XX:PermSize>128M</-XX:PermSize> + <-XX:MaxPermSize>128M</-XX:MaxPermSize> + </options> +</java> http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqnamesrv ---------------------------------------------------------------------- diff --git a/bin/mqnamesrv b/bin/mqnamesrv new file mode 100644 index 0000000..ed7cd1e --- /dev/null +++ b/bin/mqnamesrv @@ -0,0 +1,45 @@ +#!/bin/sh + +# 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. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + 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 + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +sh ${ROCKETMQ_HOME}/bin/runserver.sh com.alibaba.rocketmq.namesrv.NamesrvStartup $@ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqnamesrv.exe ---------------------------------------------------------------------- diff --git a/bin/mqnamesrv.exe b/bin/mqnamesrv.exe new file mode 100644 index 0000000..e8d8fac Binary files /dev/null and b/bin/mqnamesrv.exe differ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqnamesrv.xml ---------------------------------------------------------------------- diff --git a/bin/mqnamesrv.xml b/bin/mqnamesrv.xml new file mode 100644 index 0000000..9194cbb --- /dev/null +++ b/bin/mqnamesrv.xml @@ -0,0 +1,43 @@ +<!-- + 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. + --> + +<java> + <debug>false</debug> + + <javahome>${JAVA_HOME}</javahome> + + <jvmtype>server</jvmtype> + + <mainclass>com.alibaba.rocketmq.namesrv.NamesrvStartup</mainclass> + + <properties> + <java.ext.dirs>${cpd}/../lib</java.ext.dirs> + <rocketmq.home.dir>${cpd}/..</rocketmq.home.dir> + </properties> + + <classpaths> + </classpaths> + + <options> + <-Xms512m></-Xms512m> + <-Xmx1g></-Xmx1g> + <-XX:NewSize>256M</-XX:NewSize> + <-XX:MaxNewSize>512M</-XX:MaxNewSize> + <-XX:PermSize>128M</-XX:PermSize> + <-XX:MaxPermSize>128M</-XX:MaxPermSize> + </options> +</java> http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/mqshutdown ---------------------------------------------------------------------- diff --git a/bin/mqshutdown b/bin/mqshutdown new file mode 100644 index 0000000..19561ac --- /dev/null +++ b/bin/mqshutdown @@ -0,0 +1,49 @@ +#!/bin/sh + +# 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. + +case $1 in + broker) + + pid=`ps ax | grep -i 'com.alibaba.rocketmq.broker.BrokerStartup' |grep java | grep -v grep | awk '{print $1}'` + if [ -z "$pid" ] ; then + echo "No mqbroker running." + exit -1; + fi + + echo "The mqbroker(${pid}) is running..." + + kill ${pid} + + echo "Send shutdown request to mqbroker(${pid}) OK" + ;; + namesrv) + + pid=`ps ax | grep -i 'com.alibaba.rocketmq.namesrv.NamesrvStartup' |grep java | grep -v grep | awk '{print $1}'` + if [ -z "$pid" ] ; then + echo "No mqnamesrv running." + exit -1; + fi + + echo "The mqnamesrv(${pid}) is running..." + + kill ${pid} + + echo "Send shutdown request to mqnamesrv(${pid}) OK" + ;; + *) + echo "Useage: mqshutdown broker | namesrv" +esac http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/os.sh ---------------------------------------------------------------------- diff --git a/bin/os.sh b/bin/os.sh new file mode 100644 index 0000000..17911d4 --- /dev/null +++ b/bin/os.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +# 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. + +# +# Execute Only Once +# + +export PATH=$PATH:/sbin + +# sudo sysctl -w vm.extra_free_kbytes=2000000 +# sudo sysctl -w vm.min_free_kbytes=1000000 +sudo sysctl -w vm.overcommit_memory=1 +sudo sysctl -w vm.drop_caches=1 +sudo sysctl -w vm.zone_reclaim_mode=0 +sudo sysctl -w vm.max_map_count=655360 +sudo sysctl -w vm.dirty_background_ratio=50 +sudo sysctl -w vm.dirty_ratio=50 +sudo sysctl -w vm.dirty_writeback_centisecs=360000 +sudo sysctl -w vm.page-cluster=3 +sudo sysctl -w vm.swappiness=1 + +echo 'ulimit -n 655350' >> /etc/profile +echo '* hard nofile 655350' >> /etc/security/limits.conf + +echo '* hard memlock unlimited' >> /etc/security/limits.conf +echo '* soft memlock unlimited' >> /etc/security/limits.conf + +DISK=`df -k | sort -n -r -k 2 | awk -F/ 'NR==1 {gsub(/[0-9].*/,"",$3); print $3}'` +[ "$DISK" = 'cciss' ] && DISK='cciss!c0d0' +echo 'deadline' > /sys/block/${DISK}/queue/scheduler + + +echo "---------------------------------------------------------------" +sysctl vm.extra_free_kbytes +sysctl vm.min_free_kbytes +sysctl vm.overcommit_memory +sysctl vm.drop_caches +sysctl vm.zone_reclaim_mode +sysctl vm.max_map_count +sysctl vm.dirty_background_ratio +sysctl vm.dirty_ratio +sysctl vm.dirty_writeback_centisecs +sysctl vm.page-cluster +sysctl vm.swappiness + +su - admin -c 'ulimit -n' +cat /sys/block/$DISK/queue/scheduler + +if [ -d ${HOME}/tmpfs ] ; then + echo "tmpfs exist, do nothing." +else + ln -s /dev/shm tmpfs + echo "create tmpfs ok" +fi http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/play.sh ---------------------------------------------------------------------- diff --git a/bin/play.sh b/bin/play.sh new file mode 100644 index 0000000..4abb648 --- /dev/null +++ b/bin/play.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# 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. + +# +# Name Server +# +nohup sh mqnamesrv > ns.log 2>&1 & + +# +# Service Addr +# +ADDR=`hostname -i`:9876 + +# +# Broker +# +nohup sh mqbroker -n ${ADDR} > bk.log 2>&1 & + +echo "Start Name Server and Broker Successfully, ${ADDR}" http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/runbroker.sh ---------------------------------------------------------------------- diff --git a/bin/runbroker.sh b/bin/runbroker.sh new file mode 100644 index 0000000..08d97ad --- /dev/null +++ b/bin/runbroker.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +# 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. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g" +JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8 -XX:+DisableExplicitGC" +JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/mq_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" +JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" +JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" +JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch" +JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=15g" +JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib" +#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +numactl --interleave=all pwd > /dev/null 2>&1 +if [ $? -eq 0 ] +then + if [ -z "$RMQ_NUMA_NODE" ] ; then + numactl --interleave=all $JAVA ${JAVA_OPT} $@ + else + numactl --cpunodebind=$RMQ_NUMA_NODE --membind=$RMQ_NUMA_NODE $JAVA ${JAVA_OPT} $@ + fi +else + $JAVA ${JAVA_OPT} $@ +fi http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/runserver.sh ---------------------------------------------------------------------- diff --git a/bin/runserver.sh b/bin/runserver.sh new file mode 100644 index 0000000..a0d4f0c --- /dev/null +++ b/bin/runserver.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +# 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. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g -XX:PermSize=128m -XX:MaxPermSize=320m" +JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:+DisableExplicitGC -XX:-UseParNewGC" +JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/rmq_srv_gc.log -XX:+PrintGCDetails" +JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" +JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib" +#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +$JAVA ${JAVA_OPT} $@ http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/setcache.sh ---------------------------------------------------------------------- diff --git a/bin/setcache.sh b/bin/setcache.sh new file mode 100644 index 0000000..5c72fd1 --- /dev/null +++ b/bin/setcache.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# 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. + +export PATH=$PATH:/sbin + +# +# GB +# +function changeFreeCache() +{ + EXTRA=$1 + MIN=$2 + sysctl -w vm.extra_free_kbytes=${EXTRA}000000 + sysctl -w vm.min_free_kbytes=${MIN}000000 + sysctl -w vm.swappiness=0 +} + + +if [ $# -ne 2 ] +then + echo "Usage: $0 extra_free_kbytes(GB) min_free_kbytes(GB)" + echo "Example: $0 3 1" + exit +fi + +changeFreeCache $1 $2 http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/startfsrv.sh ---------------------------------------------------------------------- diff --git a/bin/startfsrv.sh b/bin/startfsrv.sh new file mode 100644 index 0000000..21c828c --- /dev/null +++ b/bin/startfsrv.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# 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. + +if [ -z "$ROCKETMQ_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + 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 + + saveddir=`pwd` + + ROCKETMQ_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` + + cd "$saveddir" +fi + +export ROCKETMQ_HOME + +nohup sh ${ROCKETMQ_HOME}/bin/runserver.sh com.alibaba.rocketmq.filtersrv.FiltersrvStartup $@ & http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/913bd9b4/bin/tools.sh ---------------------------------------------------------------------- diff --git a/bin/tools.sh b/bin/tools.sh new file mode 100644 index 0000000..63e8884 --- /dev/null +++ b/bin/tools.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# 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. + +#=========================================================================================== +# Java Environment Setting +#=========================================================================================== +error_exit () +{ + echo "ERROR: $1 !!" + exit 1 +} + +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java +[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java +[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!" + +export JAVA_HOME +export JAVA="$JAVA_HOME/bin/java" +export BASE_DIR=$(dirname $0)/.. +export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} + +#=========================================================================================== +# JVM Configuration +#=========================================================================================== +JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn256m -XX:PermSize=128m -XX:MaxPermSize=128m" +JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib:${JAVA_HOME}/jre/lib/ext" +JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +$JAVA ${JAVA_OPT} $@
