InfluxDB Getting Started Tutorial

Introduction
InfluxDB is a timing database, details as follows
http://liubin.org/blog/2016/02/18/tsdb-intro/

Download and install
LZ downloaded from the official website is influxdb-1.2.4_windows_amd64 this version, the database does not require installation, unpacked direct use configuration is complete, the file is decompressed


influx.exe ----> influxdb command line client
influxd.exe ----> influxdb server
influxdb.conf ----> configuration file, file storage location corresponding to the specified data, the log information, the number of connections, connection time specific configuration functions, etc.

The main need to be amended as follows:
Meta section

data section

retention part

shard-percreation portion

monitor section

admin section

bind-address port server port to use depending on the circumstances, this port is used to access through a browser
http part

This port is used by a program to access the specific meaning of the various parameters detailed
https://github.com/mike-zhang/mikeBlogEssays/blob/master/2017/20170206_InfluxDB%E5%AE%89%E8%A3 % 85% E5% 8F% 8A % E9% 85% 8D% E7% BD% AE.md

Start
to open the window by cmd command window, placed into influxdb directory, execute the command: influxd.exe -config influxdb.conf to open influxdb service, while generating the corresponding file in accordance with the above profile

http://127.0.0.1:8089 can be realized graphical access, which is influxdb.conf 8087 file admin, enter this address in your browser to achieve some bind-address specified graphical access

Embodiment http request is http://178.24.1.3:8086, wherein the current IP address of 178.24.1.3 window of the machine, 8086 influxdb.conf http file bind-address portion is designated, in this way the program is available for access the address of;

Also, you can directly open influx.exe, to query the database via the command influxDB provided;

Backup
when backing up the database, according to influxdb.conf file meta, data section specifies the meta, data, wal directory, directory backup to these three;

Basic concepts
InfluxDB tutorial
https://www.linuxdaxue.com/influxdb-study-series-manual.html

Java persistence framework
official is currently available, and we interact with open source framework and database on GitHub through http api access to the database, the project address: https: //github.com/influxdata/influxdb-java, the main achievement classes are as follows

InfluxDBFactory
is a factory class, instance can return by way of a InfluxDB

InfluxDB = InfluxDBFactory.connect InfluxDB ( "http://172.17.0.2:8086", "111", "111");
. 1
InfluxDBImpl
achieved InfluxDB interface that provides basic method of operation of the database, such as a new database, delete databases , insert data, query

Point
corresponds to a row of data in a relational database, such as database data line is generally shown as a dot in the figure, so for Point, line data can be added such as Tag (column index) Field (common columns)

Query
by SQL Query configuration database name and object to be executed, passed as a parameter to the query method InfluxDBImpl class, to return a QueryResult object, which encapsulates the data generated by the query

QueryResult
this class is more complex

public class QueryResult {
private List<Result> results;
private String error;

public static class Result {
private List<Series> series;
private String error;
}

Series static class {public
Private String name;
Private the Map <String, String> Tags;
Private List <String> Columns;
Private List <List <Object >> values;
}
}
. 1
2
. 3
. 4
. 5
. 6
. 7
. 8
. 9
10
. 11
12 is
13 is
14
15
16
wherein Result and Series of internal class QueryResult nested deeper, taking much trouble data, most similar to the method of access to data

.. QueryResult.getResults Object obj = () GET (0) .getSeries () GET (0) .getValues () GET (0) .get (. 1);.
. 1
this method

InfluxDBResultMapper
may be mapped to a query structure by way of the Bean

= New new InfluxDBResultMapper resultMapper InfluxDBResultMapper ();
List <NewBean> cpuList = resultMapper.toPOJO (queryResult, NewBean.class);
. 1
2
wherein NewBean class is a POJO

Notes
by stitching StringBuilder SQL statements, query, the query tag can not pay attention to a separate column, the column must have a field

recommend

----------------
Disclaimer: This article is CSDN bloggers' Java knowledge Tong "original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source and link this statement.
Original link: https: //blog.csdn.net/zzti_erlie/article/details/76422871

Guess you like

Origin www.cnblogs.com/lhxsoft/p/11796339.html