[ISSUE#3409]fix Nacos can't start by the startup.cmd script in windows enviroment. (#3416)
This commit is contained in:
parent
75a06834f5
commit
479ef3ff65
@ -24,7 +24,7 @@ set BASE_DIR="%BASE_DIR:~0,-5%"
|
||||
set DEFAULT_SEARCH_LOCATIONS="classpath:/,classpath:/config/,file:./,file:./config/"
|
||||
set CUSTOM_SEARCH_LOCATIONS=%DEFAULT_SEARCH_LOCATIONS%,file:%BASE_DIR%/conf/
|
||||
|
||||
set MODE="standalone"
|
||||
set MODE="cluster"
|
||||
set FUNCTION_MODE="all"
|
||||
set SERVER=nacos-server
|
||||
set MODE_INDEX=-1
|
||||
@ -52,30 +52,45 @@ for %%a in (%*) do (
|
||||
set /a i+=1
|
||||
)
|
||||
|
||||
rem if nacos startup mode is standalone
|
||||
if %MODE% == "standalone" (
|
||||
set "JAVA_OPT=%JAVA_OPT% -Xms512m -Xmx512m -Xmn256m"
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.standalone=true"
|
||||
) else (
|
||||
echo "nacos is starting with standalone"
|
||||
set "NACOS_OPTS=-Dnacos.standalone=true"
|
||||
set "NACOS_JVM_OPTS=-Xms512m -Xmx512m -Xmn256m"
|
||||
)
|
||||
|
||||
rem if nacos startup mode is cluster
|
||||
if %MODE% == "cluster" (
|
||||
echo "nacos is starting with cluster"
|
||||
if %EMBEDDED_STORAGE% == "embedded" (
|
||||
set "JAVA_OPT=%JAVA_OPT% -DembeddedStorage=true"
|
||||
)
|
||||
set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
|
||||
set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%BASE_DIR%\logs\java_heapdump.hprof"
|
||||
set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages"
|
||||
set "NACOS_OPTS=-DembeddedStorage=true"
|
||||
)
|
||||
|
||||
set "NACOS_JVM_OPTS=-server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%BASE_DIR%\logs\java_heapdump.hprof -XX:-UseLargePages"
|
||||
)
|
||||
|
||||
rem set nacos's functionMode
|
||||
if %FUNCTION_MODE% == "config" (
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.functionMode=config"
|
||||
set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.functionMode=config"
|
||||
)
|
||||
|
||||
if %FUNCTION_MODE% == "naming" (
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.functionMode=naming"
|
||||
set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.functionMode=naming"
|
||||
)
|
||||
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dloader.path=%BASE_DIR%/plugins/health,%BASE_DIR%/plugins/cmdb"
|
||||
rem set nacos options
|
||||
set "NACOS_OPTS=%NACOS_OPTS% -Dloader.path=%BASE_DIR%/plugins/health,%BASE_DIR%/plugins/cmdb"
|
||||
set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.home=%BASE_DIR%"
|
||||
set "NACOS_OPTS=%NACOS_OPTS% -jar %BASE_DIR%\target\%SERVER%.jar"
|
||||
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.home=%BASE_DIR%"
|
||||
set "JAVA_OPT=%JAVA_OPT% -jar %BASE_DIR%\target\%SERVER%.jar"
|
||||
set "JAVA_OPT=%JAVA_OPT% --spring.config.location=%CUSTOM_SEARCH_LOCATIONS%"
|
||||
set "JAVA_OPT=%JAVA_OPT% --logging.config=%BASE_DIR%/conf/nacos-logback.xml"
|
||||
rem set nacos spring config location
|
||||
set "NACOS_CONFIG_OPTS=--spring.config.location=%CUSTOM_SEARCH_LOCATIONS%"
|
||||
|
||||
call "%JAVA%" %JAVA_OPT% nacos.nacos %*
|
||||
rem set nacos log4j file location
|
||||
set "NACOS_LOG4J_OPTS=--logging.config=%BASE_DIR%/conf/nacos-logback.xml"
|
||||
|
||||
|
||||
set COMMAND="%JAVA%" %NACOS_JVM_OPTS% %NACOS_OPTS% %NACOS_CONFIG_OPTS% %NACOS_LOG4J_OPTS% nacos.nacos %*
|
||||
|
||||
rem start nacos command
|
||||
%COMMAND%
|
Loading…
Reference in New Issue
Block a user