Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions confignode/src/assembly/resources/conf/confignode-env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ if %JMX_LOCAL% == "false" (
echo "setting local JMX..."
)

set CONFIGNODE_JMX_OPTS=%CONFIGNODE_JMX_OPTS% -Diotdb.jmx.local=%JMX_LOCAL%

for /f %%b in ('wmic cpu get numberofcores ^| findstr "[0-9]"') do (
set system_cpu_cores=%%b
)
Expand Down
2 changes: 1 addition & 1 deletion confignode/src/assembly/resources/conf/confignode-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ else
echo "setting local JMX..."
fi


CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Diotdb.jmx.local=$JMX_LOCAL"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Xms${HEAP_NEWSIZE}"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -Xmx${MAX_HEAP_SIZE}"
CONFIGNODE_JMX_OPTS="$CONFIGNODE_JMX_OPTS -XX:MaxDirectMemorySize=${MAX_DIRECT_MEMORY_SIZE}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
import org.apache.iotdb.commons.ServerCommandLine;
import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.iotdb.commons.exception.BadNodeUrlException;
import org.apache.iotdb.commons.exception.ConfigurationException;
import org.apache.iotdb.commons.exception.StartupException;
Expand Down Expand Up @@ -69,7 +70,7 @@ protected int run(String[] args) {
if (MODE_START.equals(mode)) {
try {
// Startup environment check
StartupChecks checks = new StartupChecks().withDefaultTest();
StartupChecks checks = new StartupChecks(IoTDBConstant.CN_ROLE).withDefaultTest();
checks.verify();
// Do ConfigNode startup checks
ConfigNodeStartupCheck.getInstance().startUpCheck();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ private IoTDBConstant() {}

public static final String BUILD_INFO;

public static final String ENV_FILE_NAME = "datanode-env";
public static final String DN_ENV_FILE_NAME = "datanode-env";
public static final String CN_ENV_FILE_NAME = "confignode-env";
public static final String IOTDB_CONF = "IOTDB_CONF";
public static final String GLOBAL_DB_NAME = "IoTDB";
public static final String CN_ROLE = "confignode";
public static final String DN_ROLE = "datanode";

public static final String DN_RPC_ADDRESS = "dn_rpc_address";
public static final String DN_RPC_PORT = "dn_rpc_port";
Expand Down Expand Up @@ -80,7 +83,8 @@ private IoTDBConstant() {}
public static final String SLOW_SQL_LOGGER_NAME = "SLOW_SQL";
public static final String COMPACTION_LOGGER_NAME = "COMPACTION";

public static final String IOTDB_JMX_PORT = "iotdb.jmx.port";
public static final String IOTDB_JMX_LOCAL = "iotdb.jmx.local";
public static final String IOTDB_JMX_PORT = "com.sun.management.jmxremote.port";

public static final String IOTDB_PACKAGE = "org.apache.iotdb.service";
public static final String IOTDB_THREADPOOL_PACKAGE = "org.apache.iotdb.threadpool";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@
public class StartupChecks {

private static final Logger logger = LoggerFactory.getLogger(StartupChecks.class);
public static final StartupCheck checkJMXPort =
() -> {
String jmxPort = System.getProperty(IoTDBConstant.IOTDB_JMX_PORT);
if (jmxPort == null) {
logger.warn(
"{} missing from {}.sh(Unix or OS X, if you use Windows," + " check conf/{}.bat)",
IoTDBConstant.IOTDB_JMX_PORT,
IoTDBConstant.ENV_FILE_NAME,
IoTDBConstant.ENV_FILE_NAME);
} else {
logger.info("JMX is enabled to receive remote connection on port {}", jmxPort);
}
};
public static final StartupCheck checkJDK =
() -> {
int version = JVMCommonUtils.getJdkVersion();
Expand All @@ -59,11 +46,36 @@ public class StartupChecks {
private final List<StartupCheck> preChecks = new ArrayList<>();
private final List<StartupCheck> defaultTests = new ArrayList<>();

public StartupChecks() {
defaultTests.add(checkJMXPort);
public StartupChecks(String nodeRole) {
defaultTests.add(() -> checkJMXPort(nodeRole));
defaultTests.add(checkJDK);
}

private void checkJMXPort(String nodeRole) {
Boolean jmxLocal = Boolean.valueOf(System.getProperty(IoTDBConstant.IOTDB_JMX_LOCAL));
String jmxPort = System.getProperty(IoTDBConstant.IOTDB_JMX_PORT);

if (jmxLocal) {
logger.info("Start JMX locally.");
return;
}

if (jmxPort == null) {
String filename =
nodeRole.equals(IoTDBConstant.DN_ROLE)
? IoTDBConstant.DN_ENV_FILE_NAME
: IoTDBConstant.CN_ENV_FILE_NAME;
logger.warn(
"{} missing from {}.sh(Unix or OS X, if you use Windows," + " check conf/{}.bat)",
IoTDBConstant.IOTDB_JMX_PORT,
filename,
filename);
} else {
logger.info(
"Start JMX remotely: JMX is enabled to receive remote connection on port {}", jmxPort);
}
}

public StartupChecks withDefaultTest() {
preChecks.addAll(defaultTests);
return this;
Expand Down
2 changes: 2 additions & 0 deletions server/src/assembly/resources/conf/datanode-env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ if %JMX_LOCAL% == "false" (
echo "setting local JMX..."
)

set IOTDB_JMX_OPTS=%IOTDB_JMX_OPTS% -Diotdb.jmx.local=%JMX_LOCAL%

for /f %%b in ('wmic cpu get numberofcores ^| findstr "[0-9]"') do (
set system_cpu_cores=%%b
)
Expand Down
2 changes: 1 addition & 1 deletion server/src/assembly/resources/conf/datanode-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ else
echo "setting local JMX..."
fi


IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Diotdb.jmx.local=$JMX_LOCAL"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xms${HEAP_NEWSIZE}"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -Xmx${MAX_HEAP_SIZE}"
IOTDB_JMX_OPTS="$IOTDB_JMX_OPTS -XX:MaxDirectMemorySize=${MAX_DIRECT_MEMORY_SIZE}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public boolean initLocalEngines() {
/** Prepare cluster IoTDB-DataNode */
private void prepareDataNode() throws StartupException {
// check iotdb server first
StartupChecks checks = new StartupChecks().withDefaultTest();
StartupChecks checks = new StartupChecks(IoTDBConstant.DN_ROLE).withDefaultTest();
checks.verify();

// Register services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static void setServiceProvider(ServiceProvider serviceProvider) {

public void active() {
processPid();
StartupChecks checks = new StartupChecks().withDefaultTest();
StartupChecks checks = new StartupChecks(IoTDBConstant.DN_ROLE).withDefaultTest();
try {
checks.verify();
} catch (StartupException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void main(String[] args) {

public void active(boolean isTesting) {
processPid();
StartupChecks checks = new StartupChecks().withDefaultTest();
StartupChecks checks = new StartupChecks(IoTDBConstant.DN_ROLE).withDefaultTest();
try {
checks.verify();
} catch (StartupException e) {
Expand Down