Skip to content

Commit b692a73

Browse files
lizhanhuizhouxinyu
authored andcommitted
[ROCKETMQ-99] Add scripts for Windows, closes apache#62
1 parent 3940924 commit b692a73

File tree

9 files changed

+259
-0
lines changed

9 files changed

+259
-0
lines changed

bin/mqadmin.cmd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@echo off
2+
rem Licensed to the Apache Software Foundation (ASF) under one or more
3+
rem contributor license agreements. See the NOTICE file distributed with
4+
rem this work for additional information regarding copyright ownership.
5+
rem The ASF licenses this file to You under the Apache License, Version 2.0
6+
rem (the "License"); you may not use this file except in compliance with
7+
rem the License. You may obtain a copy of the License at
8+
rem
9+
rem http://www.apache.org/licenses/LICENSE-2.0
10+
rem
11+
rem Unless required by applicable law or agreed to in writing, software
12+
rem distributed under the License is distributed on an "AS IS" BASIS,
13+
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
rem See the License for the specific language governing permissions and
15+
rem limitations under the License.
16+
17+
if not exist "%ROCKETMQ_HOME%\bin\tools.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & goto end
18+
call "%ROCKETMQ_HOME%\bin\tools.cmd" org.apache.rocketmq.tools.command.MQAdminStartup %*
19+
20+
:end

bin/mqbroker.cmd

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@echo off
2+
rem Licensed to the Apache Software Foundation (ASF) under one or more
3+
rem contributor license agreements. See the NOTICE file distributed with
4+
rem this work for additional information regarding copyright ownership.
5+
rem The ASF licenses this file to You under the Apache License, Version 2.0
6+
rem (the "License"); you may not use this file except in compliance with
7+
rem the License. You may obtain a copy of the License at
8+
rem
9+
rem http://www.apache.org/licenses/LICENSE-2.0
10+
rem
11+
rem Unless required by applicable law or agreed to in writing, software
12+
rem distributed under the License is distributed on an "AS IS" BASIS,
13+
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
rem See the License for the specific language governing permissions and
15+
rem limitations under the License.
16+
17+
if not exist "%ROCKETMQ_HOME%\bin\runbroker.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & goto end
18+
19+
call "%ROCKETMQ_HOME%\bin\runbroker.cmd" org.apache.rocketmq.broker.BrokerStartup %*
20+
21+
:end

bin/mqfiltersrv.cmd

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@echo off
2+
rem Licensed to the Apache Software Foundation (ASF) under one or more
3+
rem contributor license agreements. See the NOTICE file distributed with
4+
rem this work for additional information regarding copyright ownership.
5+
rem The ASF licenses this file to You under the Apache License, Version 2.0
6+
rem (the "License"); you may not use this file except in compliance with
7+
rem the License. You may obtain a copy of the License at
8+
rem
9+
rem http://www.apache.org/licenses/LICENSE-2.0
10+
rem
11+
rem Unless required by applicable law or agreed to in writing, software
12+
rem distributed under the License is distributed on an "AS IS" BASIS,
13+
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
rem See the License for the specific language governing permissions and
15+
rem limitations under the License.
16+
17+
if not exist "%ROCKETMQ_HOME%\bin\runbroker.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & goto end
18+
19+
call "%ROCKETMQ_HOME%\bin\runserver.cmd" org.apache.rocketmq.filtersrv.FiltersrvStartup %*
20+
21+
:end

bin/mqnamesrv.cmd

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@echo off
2+
rem Licensed to the Apache Software Foundation (ASF) under one or more
3+
rem contributor license agreements. See the NOTICE file distributed with
4+
rem this work for additional information regarding copyright ownership.
5+
rem The ASF licenses this file to You under the Apache License, Version 2.0
6+
rem (the "License"); you may not use this file except in compliance with
7+
rem the License. You may obtain a copy of the License at
8+
rem
9+
rem http://www.apache.org/licenses/LICENSE-2.0
10+
rem
11+
rem Unless required by applicable law or agreed to in writing, software
12+
rem distributed under the License is distributed on an "AS IS" BASIS,
13+
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
rem See the License for the specific language governing permissions and
15+
rem limitations under the License.
16+
17+
if not exist "%ROCKETMQ_HOME%\bin\runserver.cmd" echo Please set the ROCKETMQ_HOME variable in your environment! & goto end
18+
19+
call "%ROCKETMQ_HOME%\bin\runserver.cmd" org.apache.rocketmq.namesrv.NamesrvStartup %*
20+
21+
:end

bin/mqshutdown.cmd

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@echo off
2+
rem Licensed to the Apache Software Foundation (ASF) under one or more
3+
rem contributor license agreements. See the NOTICE file distributed with
4+
rem this work for additional information regarding copyright ownership.
5+
rem The ASF licenses this file to You under the Apache License, Version 2.0
6+
rem (the "License"); you may not use this file except in compliance with
7+
rem the License. You may obtain a copy of the License at
8+
rem
9+
rem http://www.apache.org/licenses/LICENSE-2.0
10+
rem
11+
rem Unless required by applicable law or agreed to in writing, software
12+
rem distributed under the License is distributed on an "AS IS" BASIS,
13+
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
rem See the License for the specific language governing permissions and
15+
rem limitations under the License.
16+
17+
if not exist "%JAVA_HOME%\bin\jps.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & goto end
18+
19+
setlocal
20+
21+
set "PATH=%JAVA_HOME%\bin;%PATH%"
22+
23+
if /I "%1" == "broker" (
24+
echo killing broker
25+
for /f "tokens=1" %%i in ('jps -m ^| find "BrokerStartup"') do ( taskkill /F /PID %%i )
26+
echo Done!
27+
) else if /I "%1" == "namesrv" (
28+
echo killing name server
29+
30+
for /f "tokens=1" %%i in ('jps -m ^| find "NamesrvStartup"') do ( taskkill /F /PID %%i )
31+
32+
echo Done!
33+
) else (
34+
echo Unknown role to kill, please specify broker or namesrv
35+
)
36+
37+
:end

bin/play.cmd

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@echo off
2+
rem Licensed to the Apache Software Foundation (ASF) under one or more
3+
rem contributor license agreements. See the NOTICE file distributed with
4+
rem this work for additional information regarding copyright ownership.
5+
rem The ASF licenses this file to You under the Apache License, Version 2.0
6+
rem (the "License"); you may not use this file except in compliance with
7+
rem the License. You may obtain a copy of the License at
8+
rem
9+
rem http://www.apache.org/licenses/LICENSE-2.0
10+
rem
11+
rem Unless required by applicable law or agreed to in writing, software
12+
rem distributed under the License is distributed on an "AS IS" BASIS,
13+
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
rem See the License for the specific language governing permissions and
15+
rem limitations under the License.
16+
17+
START /B mqnamesrv > ns.log
18+
START /B mqbroker -n localhost:9876 > bk.log
19+
echo "Start Name Server and Broker Successfully."

bin/runbroker.cmd

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@echo off
2+
rem Licensed to the Apache Software Foundation (ASF) under one or more
3+
rem contributor license agreements. See the NOTICE file distributed with
4+
rem this work for additional information regarding copyright ownership.
5+
rem The ASF licenses this file to You under the Apache License, Version 2.0
6+
rem (the "License"); you may not use this file except in compliance with
7+
rem the License. You may obtain a copy of the License at
8+
rem
9+
rem http://www.apache.org/licenses/LICENSE-2.0
10+
rem
11+
rem Unless required by applicable law or agreed to in writing, software
12+
rem distributed under the License is distributed on an "AS IS" BASIS,
13+
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
rem See the License for the specific language governing permissions and
15+
rem limitations under the License.
16+
17+
if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & goto end
18+
set "JAVA=%JAVA_HOME%\bin\java.exe"
19+
20+
setlocal
21+
22+
set BASE_DIR=%~dp0
23+
set BASE_DIR=%BASE_DIR:~0,-1%
24+
for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd
25+
26+
set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH%
27+
28+
rem ===========================================================================================
29+
rem JVM Configuration
30+
rem ===========================================================================================
31+
set "JAVA_OPT=%JAVA_OPT% -server -Xms8g -Xmx8g -Xmn4g"
32+
set "JAVA_OPT=%JAVA_OPT% -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8 -XX:+DisableExplicitGC"
33+
set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:%HOMEPATH%\mq_gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy"
34+
set "JAVA_OPT=%JAVA_OPT% -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m"
35+
set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow"
36+
set "JAVA_OPT=%JAVA_OPT% -XX:+AlwaysPreTouch"
37+
set "JAVA_OPT=%JAVA_OPT% -XX:MaxDirectMemorySize=15g"
38+
set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages -XX:-UseBiasedLocking"
39+
set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib"
40+
set "JAVA_OPT=%JAVA_OPT% -cp %CLASSPATH%"
41+
42+
"%JAVA%" %JAVA_OPT% %*
43+
44+
:end

bin/runserver.cmd

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@echo off
2+
rem Licensed to the Apache Software Foundation (ASF) under one or more
3+
rem contributor license agreements. See the NOTICE file distributed with
4+
rem this work for additional information regarding copyright ownership.
5+
rem The ASF licenses this file to You under the Apache License, Version 2.0
6+
rem (the "License"); you may not use this file except in compliance with
7+
rem the License. You may obtain a copy of the License at
8+
rem
9+
rem http://www.apache.org/licenses/LICENSE-2.0
10+
rem
11+
rem Unless required by applicable law or agreed to in writing, software
12+
rem distributed under the License is distributed on an "AS IS" BASIS,
13+
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
rem See the License for the specific language governing permissions and
15+
rem limitations under the License.
16+
17+
18+
if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & goto end
19+
set "JAVA=%JAVA_HOME%\bin\java.exe"
20+
21+
setlocal
22+
23+
set BASE_DIR=%~dp0
24+
set BASE_DIR=%BASE_DIR:~0,-1%
25+
for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd
26+
27+
set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH%
28+
29+
set "JAVA_OPT=%JAVA_OPT% -server -Xms4g -Xmx4g -Xmn2g -XX:PermSize=128m -XX:MaxPermSize=320m"
30+
set "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"
31+
set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:"%HOMEPATH%\rmq_srv_gc.log" -XX:+PrintGCDetails"
32+
set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow"
33+
set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages"
34+
set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib"
35+
set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%""
36+
37+
"%JAVA%" %JAVA_OPT% %*
38+
39+
:end

bin/tools.cmd

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@echo off
2+
rem Licensed to the Apache Software Foundation (ASF) under one or more
3+
rem contributor license agreements. See the NOTICE file distributed with
4+
rem this work for additional information regarding copyright ownership.
5+
rem The ASF licenses this file to You under the Apache License, Version 2.0
6+
rem (the "License"); you may not use this file except in compliance with
7+
rem the License. You may obtain a copy of the License at
8+
rem
9+
rem http://www.apache.org/licenses/LICENSE-2.0
10+
rem
11+
rem Unless required by applicable law or agreed to in writing, software
12+
rem distributed under the License is distributed on an "AS IS" BASIS,
13+
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
rem See the License for the specific language governing permissions and
15+
rem limitations under the License.
16+
17+
if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! & goto end
18+
19+
set "JAVA=%JAVA_HOME%\bin\java.exe"
20+
21+
setlocal
22+
set BASE_DIR=%~dp0
23+
set BASE_DIR=%BASE_DIR:~0,-1%
24+
for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd
25+
26+
set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH%
27+
28+
rem ===========================================================================================
29+
rem JVM Configuration
30+
rem ===========================================================================================
31+
set "JAVA_OPT=%JAVA_OPT% -server -Xms1g -Xmx1g -Xmn256m -XX:PermSize=128m -XX:MaxPermSize=128m"
32+
set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs="%BASE_DIR%\lib";"%JAVA_HOME%\jre\lib\ext""
33+
set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%""
34+
35+
"%JAVA%" %JAVA_OPT% %*
36+
37+
:end

0 commit comments

Comments
 (0)