Skip to content

Commit

Permalink
optimize: support jmx port in seata (#5939)
Browse files Browse the repository at this point in the history
  • Loading branch information
leizhiyuan authored Oct 18, 2023
1 parent d650a3c commit 046e384
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changes/en-us/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Add changes here for all PR submitted to the develop branch.
- [[#5828](https://github.com/seata/seata/pull/5828)] fix codecov chart not display
- [[#5927](https://github.com/seata/seata/pull/5927)] optimize some scripts related to Apollo
- [[#5918](https://github.com/seata/seata/pull/5918)] standardized the properties of codecov.yml
- [[#5939](https://github.com/seata/seata/pull/5939)] support jmx port in seata

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


Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
2 changes: 2 additions & 0 deletions changes/zh-cn/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [[#5828](https://github.com/seata/seata/pull/5828)] 修正 `codecov chart` 不展示的问题
- [[#5927](https://github.com/seata/seata/pull/5927)] 优化一些与 Apollo 相关的脚本
- [[#5918](https://github.com/seata/seata/pull/5918)] 修正codecov.yml不标准属性
- [[#5939](https://github.com/seata/seata/pull/5939)] 支持 jmx 监控配置

### security:
- [[#5867](https://github.com/seata/seata/pull/5867)] 修复npm package漏洞
Expand All @@ -38,5 +39,6 @@
- [capthua](https://github.com/capthua)
- [funky-eyes](https://github.com/funky-eyes)
- [iquanzhan](https://github.com/iquanzhan)
- [leizhiyuan](https://github.com/leizhiyuan)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
15 changes: 14 additions & 1 deletion distribution/bin/seata-server.bat
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,21 @@ if "%SKYWALKING_ENABLE%"=="true" (
) else (
echo "apm-skywalking not enabled"
)
if "%JMX_ENABLE%"=="true" (
set JMX_PORT=%JMX_PORT%
set JMX_OPTS=%JMX_OPTS%
if "%JMX_OPTS%"=="" (
set "JMX_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
)
if "%JMX_PORT%"=="" (
set "JMX_OPTS=%JMX_OPTS% -Dcom.sun.management.jmxremote.port=10055 -Dcom.sun.management.jmxremote.rmi.port=10055"
)
echo "JMX enabled"
) else (
echo "JMX disabled"
)

%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%
%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%
if %ERRORLEVEL% NEQ 0 goto error
goto end

Expand Down
15 changes: 15 additions & 0 deletions distribution/bin/seata-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,21 @@ fi
JAVA_OPT="${JAVA_OPT} -Dio.netty.leakDetectionLevel=advanced"
JAVA_OPT="${JAVA_OPT} -Dapp.name=seata-server -Dapp.pid=${$} -Dapp.home=${BASEDIR} -Dbasedir=${BASEDIR}"

if [ "$JMX_ENABLE" = "true" ]; then
JMX_PORT=$JMX_PORT
JMX_OPTS=$JMX_OPTS
if [ -z "$JMX_OPTS" ]; then
JMX_OPTS=" -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false "
fi
if [ -z "$JMX_PORT" ]; then
JMX_OPTS=" $JMX_OPTS -Dcom.sun.management.jmxremote.port=${JMX_PORT:="10055"} -Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT:="10055"} "
fi
echo "JMX enabled"
else
echo "JMX disabled"
fi

JAVA_OPT="${JAVA_OPT} ${JMX_OPTS}"

if [ ! -x "$BASEDIR"/logs ]; then
mkdir "$BASEDIR"/logs
Expand Down

0 comments on commit 046e384

Please sign in to comment.