未验证 提交 5c70337c 编写于 作者: X Xiangdong Huang 提交者: GitHub

Merge pull request #67 from apache/openfile_doc

[IOTDB-25] Add some doc in user guide for JMX MBean Monitor
......@@ -33,6 +33,8 @@
- [Engine Layer](#engine-layer)
- [System Monitor](#system-monitor)
- [System Status Monitoring](#system-status-monitoring)
- [JMX MBean Monitoring](#jmx-mbean-monitoring)
- [MBean Monitor Attributes List](#mbean-monitor-attributes-list)
- [Data Status Monitoring](#data-status-monitoring)
- [Writing Data Monitor](#writing-data-monitor)
- [Example](#example)
......@@ -542,6 +544,131 @@ Currently, IoTDB provides users to use Java's JConsole tool to monitor system st
After starting JConsole tool and connecting to IoTDB server, you will have a basic look at IoTDB system status(CPU Occupation, in-memory information, etc.). See [official documentation](https://docs.oracle.com/javase/7/docs/technotes/guides/management/jconsole.html) for more informations.
#### JMX MBean Monitoring
By using JConsole tool and connecting with JMX you can see some system statistics and parameters.
This section describes how to use the JConsole ```Mbean``` tab to monitor the number of files opened by the IoTDB service process, the size of the data file, and so on. Once connected to JMX, you can find the ```MBean``` named ```org.apache.iotdb.service``` through the ```MBeans``` tab, as shown in the following Figure.
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/20263106/53316064-54aec080-3901-11e9-9a49-76563ac09192.png">
There are several attributes under Monitor, including the numbers of files opened in different folders, the data file size statistics and the values of some system parameters. By double-clicking the value corresponding to an attribute it can also display a line chart of that attribute. In particular, all the opened file count statistics are currently only supported on ```MacOS``` and most ```Linux``` distro except ```CentOS```. For the OS not supported these statistics will return ```-2```. See the following section for specific introduction of the Monitor attributes.
##### MBean Monitor Attributes List
* DataSizeInByte
|Name| DataSizeInByte |
|:---:|:---|
|Description| The total size of data file.|
|Unit| Byte |
|Type| Long |
* FileNodeNum
|Name| FileNodeNum |
|:---:|:---|
|Description| The count number of FileNode. (Currently not supported)|
|Type| Long |
* OverflowCacheSize
|Name| OverflowCacheSize |
|:---:|:---|
|Description| The size of out-of-order data cache. (Currently not supported)|
|Unit| Byte |
|Type| Long |
* BufferWriteCacheSize
|Name| BufferWriteCacheSize |
|:---:|:---|
|Description| The size of BufferWriter cache. (Currently not supported)|
|Unit| Byte |
|Type| Long |
* BaseDirectory
|Name| BaseDirectory |
|:---:|:---|
|Description| The absolute directory of data file. |
|Type| String |
* WriteAheadLogStatus
|Name| WriteAheadLogStatus |
|:---:|:---|
|Description| The status of write-ahead-log (WAL). ```True``` means WAL is enabled. |
|Type| Boolean |
* TotalOpenFileNum
|Name| TotalOpenFileNum |
|:---:|:---|
|Description| All the opened file number of IoTDB server process. |
|Type| Int |
* DeltaOpenFileNum
|Name| DeltaOpenFileNum |
|:---:|:---|
|Description| The opened TsFile file number of IoTDB server process. |
|Default Directory| /data/data/settled |
|Type| Int |
* OverflowOpenFileNum
|Name| OverflowOpenFileNum |
|:---:|:---|
|Description| The opened out-of-order data file number of IoTDB server process. |
|Default Directory| /data/data/overflow |
|Type| Int |
* WalOpenFileNum
|Name| WalOpenFileNum |
|:---:|:---|
|Description| The opened write-ahead-log file number of IoTDB server process. |
|Default Directory| /data/wal |
|Type| Int |
* MetadataOpenFileNum
|Name| MetadataOpenFileNum |
|:---:|:---|
|Description| The opened meta-data file number of IoTDB server process. |
|Default Directory| /data/system/schema |
|Type| Int |
* DigestOpenFileNum
|Name| DigestOpenFileNum |
|:---:|:---|
|Description| The opened info file number of IoTDB server process. |
|Default Directory| /data/system/info |
|Type| Int |
* SocketOpenFileNum
|Name| SocketOpenFileNum |
|:---:|:---|
|Description| The Socket link (TCP or UDP) number of the operation system. |
|Type| Int |
* MergePeriodInSecond
|Name| MergePeriodInSecond |
|:---:|:---|
|Description| The interval at which the IoTDB service process periodically triggers the merge process. |
|Unit| Second |
|Type| Long |
* ClosePeriodInSecond
|Name| ClosePeriodInSecond |
|:---:|:---|
|Description| The interval at which the IoTDB service process periodically flushes memory data to disk. |
|Unit| Second |
|Type| Long |
### Data Status Monitoring
This module is the statistical monitoring method provided by IoTDB for users to store data information. We will record the statistical data in the system and store it in the database. The current 0.7.0 version of IoTDB provides statistics for writing data.
......@@ -692,9 +819,9 @@ At the same time, in order to facilitate the debugging of the system by the deve
#### Connect JMX
Here we use Jconsole to connect with JMX.
Here we use JConsole to connect with JMX.
Start the Jconsole, establish a new JMX connection with the IoTDB Server (you can select the local process or input the IP and PORT for remote connection, the default operation port of the IoTDB JMX service is 31999). Fig 4.1 shows the connection GUI of jconsole.
Start the JConsole, establish a new JMX connection with the IoTDB Server (you can select the local process or input the IP and PORT for remote connection, the default operation port of the IoTDB JMX service is 31999). Fig 4.1 shows the connection GUI of JConsole.
<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/13203019/51577195-f94d7500-1ef3-11e9-999a-b4f67055d80e.png">
......
......@@ -26,6 +26,7 @@ import java.util.Collections;
import java.util.EnumMap;
import java.util.List;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBConstant;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.conf.directories.Directories;
import org.slf4j.Logger;
......@@ -38,7 +39,7 @@ public class OpenFileNumUtil {
private static final int PID_ERROR_CODE = -1;
private static final int UNSUPPORTED_OS_ERROR_CODE = -2;
private static final int UNKNOWN_STATISTICS_ERROR_CODE = -3;
private static final String IOTDB_PROCESS_KEY_WORD = "iotdb.IoTDB";
private static final String IOTDB_PROCESS_KEY_WORD = IoTDBConstant.GLOBAL_DB_NAME;
private static final String LINUX_OS_NAME = "linux";
private static final String MAC_OS_NAME = "mac";
private static final String SEARCH_PID_LINUX = "ps -aux | grep -i %s | grep -v grep";
......@@ -56,7 +57,7 @@ public class OpenFileNumUtil {
* constructor, process key word is defined by IOTDB_PROCESS_KEY_WORD.
*/
private OpenFileNumUtil() {
pid = getPid();
pid = getIotdbPid();
}
/**
......@@ -89,11 +90,11 @@ public class OpenFileNumUtil {
}
/**
* get process ID by executing command.
* get IoTDB server process ID by executing command.
*
* @return pid
* @return pid of IoTDB server process
*/
private static int getPid() {
private static int getIotdbPid() {
int iotdbPid = -1;
Process pro1;
Runtime r = Runtime.getRuntime();
......@@ -104,11 +105,10 @@ public class OpenFileNumUtil {
if (osName.startsWith(LINUX_OS_NAME) || osName.startsWith(MAC_OS_NAME)) {
try {
String command;
String processName = IOTDB_PROCESS_KEY_WORD;
if (osName.startsWith(LINUX_OS_NAME)) {
command = String.format(SEARCH_PID_LINUX, processName);
command = String.format(SEARCH_PID_LINUX, IOTDB_PROCESS_KEY_WORD);
} else {
command = String.format(SEARCH_PID_MAC, processName);
command = String.format(SEARCH_PID_MAC, IOTDB_PROCESS_KEY_WORD);
}
COMMAND_TEMPLATE[2] = command;
pro1 = r.exec(COMMAND_TEMPLATE);
......@@ -125,10 +125,10 @@ public class OpenFileNumUtil {
in1.close();
pro1.destroy();
} catch (IOException e) {
LOGGER.error("Cannot get pid of IoTDB process because {}", e.getMessage());
LOGGER.error("Cannot get PID of IoTDB process because ", e);
}
} else {
LOGGER.warn("Unsupported OS {} for OpenFileNumUtil getting Pid.", os);
LOGGER.warn("Unsupported OS {} for OpenFileNumUtil to get the PID of IoTDB.", os);
}
return iotdbPid;
}
......@@ -204,7 +204,7 @@ public class OpenFileNumUtil {
in.close();
pro.destroy();
} catch (Exception e) {
LOGGER.error("Cannot get open file number of IoTDB process because {}", e.getMessage());
LOGGER.error("Cannot get open file number of IoTDB process because ", e);
}
return resultMap;
}
......
......@@ -152,7 +152,7 @@ public class OpenFileNumUtilTest {
LOGGER.debug("Create a file {} successfully", file);
fileWriterList.add(new FileWriter(file));
} else {
LOGGER.error("create test file {} failed.", file.getPath());
LOGGER.error("create test file {} failed when creating file writer.", file.getPath());
}
} catch (IOException e) {
LOGGER.error(e.getMessage());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册