You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/02/27 12:51:16 UTC

[incubator-iotdb] branch master updated: [IOTDB-479&328] add JMX in doc and check config when startup (#849)

This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new d6ae1c3  [IOTDB-479&328] add JMX in doc and check config when startup (#849)
d6ae1c3 is described below

commit d6ae1c3b82410e336938259c9b8aa11967db820e
Author: SilverNarcissus <15...@smail.nju.edu.cn>
AuthorDate: Thu Feb 27 20:51:06 2020 +0800

    [IOTDB-479&328] add JMX in doc and check config when startup (#849)
---
 .../UserGuide/0-Get Started/1-QuickStart.md        |  7 +++++
 .../org/apache/iotdb/db/conf/IoTDBConfigCheck.java | 33 ++++++++++++++--------
 2 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/docs/Documentation/UserGuide/0-Get Started/1-QuickStart.md b/docs/Documentation/UserGuide/0-Get Started/1-QuickStart.md
index fb05a34..f6e2300 100755
--- a/docs/Documentation/UserGuide/0-Get Started/1-QuickStart.md	
+++ b/docs/Documentation/UserGuide/0-Get Started/1-QuickStart.md	
@@ -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
 
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
index e4e8e31..ec14db3 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
@@ -36,8 +36,9 @@ 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() {
@@ -45,25 +46,27 @@ public class IoTDBConfigCheck {
   }
 
   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.");
@@ -87,8 +90,9 @@ public class IoTDBConfigCheck {
         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:");
         }
       }
@@ -100,17 +104,22 @@ public class IoTDBConfigCheck {
             .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);
     }