Skip to content

Commit

Permalink
Merge bd2d423 into 32c6fb0
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverNarcissus committed Feb 27, 2020
2 parents 32c6fb0 + bd2d423 commit 5201677
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
7 changes: 7 additions & 0 deletions docs/Documentation/UserGuide/0-Get Started/1-QuickStart.md
Expand Up @@ -92,6 +92,13 @@ Users can start IoTDB by the start-server script under the sbin folder.
> sbin\start-server.bat
```

if you want to use JMX to connect IOTDB, you may need to add

```
-Dcom.sun.management.jmxremote.rmi.port=PORT -Djava.rmi.server.hostname=IP
```
to $IOTDB_JMX_OPTS in iotdb-env.sh. or iotdb-env.bat


### Use IoTDB

Expand Down
33 changes: 21 additions & 12 deletions server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
Expand Up @@ -36,34 +36,37 @@ public class IoTDBConfigCheck {
private static final IoTDBConfigCheck INSTANCE = new IoTDBConfigCheck();
private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class);
// this is a initial parameter.
private static String TIMESTAMP_PRECISION = "ms";
private static long PARTITION_INTERVAL = 86400;
private static String timestampPrecision = "ms";
private static long partitionInterval = 86400;
private static String tsfileFileSystem = "LOCAL";
private Properties properties = new Properties();

public static final IoTDBConfigCheck getInstance() {
return IoTDBConfigCheck.INSTANCE;
}

public void checkConfig() {
TIMESTAMP_PRECISION = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();
timestampPrecision = IoTDBDescriptor.getInstance().getConfig().getTimestampPrecision();

// check time stamp precision
if (!(TIMESTAMP_PRECISION.equals("ms") || TIMESTAMP_PRECISION.equals("us")
|| TIMESTAMP_PRECISION.equals("ns"))) {
if (!(timestampPrecision.equals("ms") || timestampPrecision.equals("us")
|| timestampPrecision.equals("ns"))) {
logger.error("Wrong timestamp precision, please set as: ms, us or ns ! Current is: "
+ TIMESTAMP_PRECISION);
+ timestampPrecision);
System.exit(-1);
}

PARTITION_INTERVAL = IoTDBDescriptor.getInstance().getConfig()
partitionInterval = IoTDBDescriptor.getInstance().getConfig()
.getPartitionInterval();

// check partition interval
if (PARTITION_INTERVAL <= 0) {
if (partitionInterval <= 0) {
logger.error("Partition interval must larger than 0!");
System.exit(-1);
}

tsfileFileSystem = IoTDBDescriptor.getInstance().getConfig().getTsFileStorageFs().toString();

createDir(SCHEMA_DIR);
checkFile(SCHEMA_DIR);
logger.info("System configuration is ok.");
Expand All @@ -87,8 +90,9 @@ private void checkFile(String filepath) {
file.createNewFile();
logger.info(" {} has been created.", file.getAbsolutePath());
try (FileOutputStream outputStream = new FileOutputStream(file.toString())) {
properties.setProperty("timestamp_precision", TIMESTAMP_PRECISION);
properties.setProperty("storage_group_time_range", String.valueOf(PARTITION_INTERVAL));
properties.setProperty("timestamp_precision", timestampPrecision);
properties.setProperty("storage_group_time_range", String.valueOf(partitionInterval));
properties.setProperty("tsfile_storage_fs", tsfileFileSystem);
properties.store(outputStream, "System properties:");
}
}
Expand All @@ -100,17 +104,22 @@ private void checkFile(String filepath) {
.getFile(filepath + File.separator + PROPERTIES_FILE_NAME);
try (FileInputStream inputStream = new FileInputStream(inputFile.toString())) {
properties.load(new InputStreamReader(inputStream, TSFileConfig.STRING_CHARSET));
if (!properties.getProperty("timestamp_precision").equals(TIMESTAMP_PRECISION)) {
if (!properties.getProperty("timestamp_precision").equals(timestampPrecision)) {
logger.error("Wrong timestamp precision, please set as: " + properties
.getProperty("timestamp_precision") + " !");
System.exit(-1);
}
if (!(Long.parseLong(properties.getProperty("storage_group_time_range"))
== PARTITION_INTERVAL)) {
== partitionInterval)) {
logger.error("Wrong storage group time range, please set as: " + properties
.getProperty("storage_group_time_range") + " !");
System.exit(-1);
}
if (!(properties.getProperty("tsfile_storage_fs").equals(tsfileFileSystem))) {
logger.error("Wrong tsfile file system, please set as: " + properties
.getProperty("tsfile_storage_fs") + " !");
System.exit(-1);
}
} catch (IOException e) {
logger.error("Load system.properties from {} failed.", file.getAbsolutePath(), e);
}
Expand Down

0 comments on commit 5201677

Please sign in to comment.