Skip to content

Commit 046e384

Browse files
authored
optimize: support jmx port in seata (#5939)
1 parent d650a3c commit 046e384

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

changes/en-us/develop.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Add changes here for all PR submitted to the develop branch.
2020
- [[#5828](https://github.com/seata/seata/pull/5828)] fix codecov chart not display
2121
- [[#5927](https://github.com/seata/seata/pull/5927)] optimize some scripts related to Apollo
2222
- [[#5918](https://github.com/seata/seata/pull/5918)] standardized the properties of codecov.yml
23+
- [[#5939](https://github.com/seata/seata/pull/5939)] support jmx port in seata
2324

2425
### security:
2526
- [[#5867](https://github.com/seata/seata/pull/5867)] fix npm package vulnerabilities
@@ -38,6 +39,7 @@ Thanks to these contributors for their code commits. Please report an unintended
3839
- [capthua](https://github.com/capthua)
3940
- [funky-eyes](https://github.com/funky-eyes)
4041
- [iquanzhan](https://github.com/iquanzhan)
42+
- [leizhiyuan](https://github.com/leizhiyuan)
4143

4244

4345
Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.

changes/zh-cn/develop.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- [[#5828](https://github.com/seata/seata/pull/5828)] 修正 `codecov chart` 不展示的问题
2121
- [[#5927](https://github.com/seata/seata/pull/5927)] 优化一些与 Apollo 相关的脚本
2222
- [[#5918](https://github.com/seata/seata/pull/5918)] 修正codecov.yml不标准属性
23+
- [[#5939](https://github.com/seata/seata/pull/5939)] 支持 jmx 监控配置
2324

2425
### security:
2526
- [[#5867](https://github.com/seata/seata/pull/5867)] 修复npm package漏洞
@@ -38,5 +39,6 @@
3839
- [capthua](https://github.com/capthua)
3940
- [funky-eyes](https://github.com/funky-eyes)
4041
- [iquanzhan](https://github.com/iquanzhan)
42+
- [leizhiyuan](https://github.com/leizhiyuan)
4143

4244
同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。

distribution/bin/seata-server.bat

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,21 @@ if "%SKYWALKING_ENABLE%"=="true" (
9292
) else (
9393
echo "apm-skywalking not enabled"
9494
)
95+
if "%JMX_ENABLE%"=="true" (
96+
set JMX_PORT=%JMX_PORT%
97+
set JMX_OPTS=%JMX_OPTS%
98+
if "%JMX_OPTS%"=="" (
99+
set "JMX_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
100+
)
101+
if "%JMX_PORT%"=="" (
102+
set "JMX_OPTS=%JMX_OPTS% -Dcom.sun.management.jmxremote.port=10055 -Dcom.sun.management.jmxremote.rmi.port=10055"
103+
)
104+
echo "JMX enabled"
105+
) else (
106+
echo "JMX disabled"
107+
)
95108

96-
%JAVACMD% %JAVA_OPTS% %SKYWALKING_OPTS% -server -Dloader.path="%BASEDIR%"/lib -Xmx2048m -Xms2048m -Xss512k -XX:SurvivorRatio=10 -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m -XX:MaxDirectMemorySize=1024m -XX:-OmitStackTraceInFastThrow -XX:-UseAdaptiveSizePolicy -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="%BASEDIR%"/logs/java_heapdump.hprof -XX:+DisableExplicitGC -Xloggc:"%BASEDIR%"/logs/seata_gc.log -verbose:gc -Dio.netty.leakDetectionLevel=advanced -classpath %CLASSPATH% -Dapp.name="seata-server" -Dapp.repo="%REPO%" -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" -Dspring.config.additional-location="%BASEDIR%"/conf/ -Dspring.config.location="%BASEDIR%"/conf/application.yml -Dlogging.config="%BASEDIR%"/conf/logback-spring.xml -jar "%BASEDIR%"/target/seata-server.jar %CMD_LINE_ARGS%
109+
%JAVACMD% %JAVA_OPTS% %SKYWALKING_OPTS% %JMX_OPTS% -server -Dloader.path="%BASEDIR%"/lib -Xmx2048m -Xms2048m -Xss512k -XX:SurvivorRatio=10 -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m -XX:MaxDirectMemorySize=1024m -XX:-OmitStackTraceInFastThrow -XX:-UseAdaptiveSizePolicy -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="%BASEDIR%"/logs/java_heapdump.hprof -XX:+DisableExplicitGC -Xloggc:"%BASEDIR%"/logs/seata_gc.log -verbose:gc -Dio.netty.leakDetectionLevel=advanced -classpath %CLASSPATH% -Dapp.name="seata-server" -Dapp.repo="%REPO%" -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" -Dspring.config.additional-location="%BASEDIR%"/conf/ -Dspring.config.location="%BASEDIR%"/conf/application.yml -Dlogging.config="%BASEDIR%"/conf/logback-spring.xml -jar "%BASEDIR%"/target/seata-server.jar %CMD_LINE_ARGS%
97110
if %ERRORLEVEL% NEQ 0 goto error
98111
goto end
99112

distribution/bin/seata-setup.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,21 @@ fi
150150
JAVA_OPT="${JAVA_OPT} -Dio.netty.leakDetectionLevel=advanced"
151151
JAVA_OPT="${JAVA_OPT} -Dapp.name=seata-server -Dapp.pid=${$} -Dapp.home=${BASEDIR} -Dbasedir=${BASEDIR}"
152152

153+
if [ "$JMX_ENABLE" = "true" ]; then
154+
JMX_PORT=$JMX_PORT
155+
JMX_OPTS=$JMX_OPTS
156+
if [ -z "$JMX_OPTS" ]; then
157+
JMX_OPTS=" -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false "
158+
fi
159+
if [ -z "$JMX_PORT" ]; then
160+
JMX_OPTS=" $JMX_OPTS -Dcom.sun.management.jmxremote.port=${JMX_PORT:="10055"} -Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT:="10055"} "
161+
fi
162+
echo "JMX enabled"
163+
else
164+
echo "JMX disabled"
165+
fi
166+
167+
JAVA_OPT="${JAVA_OPT} ${JMX_OPTS}"
153168

154169
if [ ! -x "$BASEDIR"/logs ]; then
155170
mkdir "$BASEDIR"/logs

0 commit comments

Comments
 (0)