InfluxDB is a time series database designed to handle high write and query loads. It is an integral part of the TICK stack. InfluxDB is intended to be used as a backing store for any use case involving large amounts of time-stamped data, including DevOps monitoring, application metrics, IoT sensor data, and real-time analysis.
Choose version 1.8 and download it on windows.
[The page has been revised, and no specific download link can be found. But the official website is as above. 】
2. Find the downloaded file in the local file and unzip it to the directory you want to install.
Example: My installation is in D:\Program Files\influxdb-1.8.3-1
Modify the configuration file.
3. Double-click influxd.exe to open the program.
4. Open on the command line.
Enter the corresponding path to execute.
influxd.exe -config influxdb.conf
Official document: https://docs.influxdata.com/influxdb/v1.8/
- Enter influx
- View help
- View the database (you do not need a semicolon)
- Create a database (student)
create database student
- Delete the database (student)
drop database student
- Use database (student)
There is no concept of creating a new table in Influx. The table is automatically created when inserting data.
insert test,id=1 value=1
- Viewing the table
measurement is equivalent to the concept of a table in mysql.
- View the data of the table
select * from test
- Query lat and lng two fields
select lat,lng from student
- Query the three fields of time, lat and lng
select time,lat,lng from student
- Format time
- Small problem: wrong time
My current time display is wrong, and the environment is windows. The query time is 8h less than the correct time.
"The bottom layer of influxdb is written in go language, and the time zone database cannot be obtained correctly on the windows machine, so whether it is the original time zone in the document or "Asia/Shanghai", the same error is reported. There are three solutions, or you can install it on linux , Either install the go environment on windows, or the backend converts the time zone by itself" -----Comments from other blogs.
1. Modify the time in the configuration
将serverTimezone的配置改为Asia/Shanghai url: jdbc:mysql://184.108.40.206:3306/bfc?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useSSL=false
2. Manually add time to the dao layer code.
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private Date createDate;
drop measurement test
After deleting, you will find that the current database is unable to find the data content of the table.
- Insert a multi-field table
Table name: student
tag (tag): id
filed (field): lat, lng, sid
insert + measurement + “,” + tag=value,tag=value + +
field=value,field=value Tag and tag are separated by commas; field and field are separated by commas,
tag and field are separated by spaces All are string types, do not need quotation marks to wrap the value
field. If it is a string type, you need to add quotation marks
insert student,id=1 lat=1,lng=1,sid=1 insert student,id=2 lat=2,lng=2,sid=2
- Query table data
select * from student
- Exit influx
Ctrl+C terminates the currently running query. Useful when an interactive query takes a long time to respond because it tries to return too much data.
exit | quit | Ctrl+D Exit the influx shell.
- Create user
- Create an administrator
CREATE USER root WITH PASSWORD 'root' WITH ALL PRIVILEGES
over. Supplements will be added later.
In order to catch up with the homework, I will start learning temporarily. Thank you for the tutorials of the community leaders. Write down notes here for subsequent reference.