INFLUXDB installation and simple use summary
Influxdb is a time-series database, because of job requirements, whether to support business scenarios under Big Data under test after installation
Description
- Install the latest version v1.6.0
- Cluster version to charge, stand-alone version free
- The internal integrated Web console was dropped by KO
I. Installation
Directly to the official website, query the corresponding download and installation method
Installation method
SHA256: fa118d657151b6de7c79592cf7516b3d9fada813262d5ebe16516f5c0bf62039wget https://dl.influxdata.com/influxdb/releases/influxdb-1.6.0.x86_64.rpmsudo yum localinstall influxdb-1.6.0.x86_64.rpm
Service Start command
# 启动命令service influxdb start# 关闭命令service influxdb stop
Attention
The default is 8086/80,882 port number, can be replaced according to your actual scene, enter the configuration file/etc/influxdb/influxdb.conf
Query bind-address, where the port number corresponding to the use of the following description
# Bind address to use for the RPC service for backup and restore.bind-address = "127.0.0.1:8088"...[http] # Determines whether HTTP endpoint is enabled. # enabled = true # The bind address used by the HTTP service. bind-address = ":8086"
II. Simple use of the console
Influx provides a console for simple operation, the following gives the basic use posture, for influxdb Some conceptual issues, put in the next article specifically to explain
First enter the console
influx# 如果修改了端口号,则需要显示指定# influx -port xxx
1. Database related
This database is similar to the database we have in common with more MySQL, and the use of the same posture
A. Displaying all databases
Description>后面跟的是命令,后面的是输出结果
> show databasesname: databasesname----_internalhh_test
B. Creating a Database
Consistent with MySQL syntax,create database xxx
> create database mytest> show databasesname: databasesname----_internalhh_testmytest
C. Deleting a database
Delete Using Drop,drop database xxx
> drop database mytest> show databasesname: databasesname----_internalhh_test
d. Select a database
> use hh_testUsing database hh_test
2. Table-Related
In the INFLUXDB, the table is not our traditional understanding table, where the jargon is called measurement
(metric? )
See all the measurement's commands
show measurements;name: measurementsname----trade
Unlike MySQL, which does not provide a dedicated create table, the newly inserted data will automatically create a nonexistent table
1. New data
insert <tbname>,<tags> <values> [timestamp]
Description
- Tbname: Data table name
- Tags: the tag field of the table
- Values: The Value field of the table
- Timestamp: The timestamp of the current data (optional, the system will be added if not provided)
> insert students,addr=wuhan phone=124> select * from studentsname: studentstime addr phone---- ---- -----1532514647456815845 wuhan 124
2. Enquiry
Query is similar to SQL, the basic structure is as follows, but there are a lot of limitations, the following explanation
select * from table where condition group by xxx order by time asc limit 10
One instance case
> insert students,addr=wuhan phone=124> insert students,addr=wuhan phone=123> insert students,addr=changsha phone=15> select * from students where phone>0 group by addr order by time desc limit 10;name: studentstags: addr=wuhantime phone---- -----1532515056470523491 1231532515052664001894 124name: studentstags: addr=changshatime phone---- -----1532515064351295620 15
3. Update and delete
When you need to update a record, directly overwrite a timestamp + all the tags are equal
> select * from studentsname: studentstime addr phone---- ---- -----1532515052664001894 wuhan 1241532515056470523491 wuhan 1231532515064351295620 changsha 15> insert students,addr=wuhan phone=111123 1532515052664001894> select * from studentsname: studentstime addr phone---- ---- -----1532515052664001894 wuhan 1111231532515056470523491 wuhan 1231532515064351295620 changsha 15
Delete a record with the delete command
> select * from studentsname: studentstime addr phone---- ---- -----1532515052664001894 wuhan 1111231532515056470523491 changsha 1231532515056470523491 wuhan 123> delete from students where time=1532515056470523491> select * from studentsname: studentstime addr phone---- ---- -----1532515052664001894 wuhan 111123
4. Delete a table
drop measurement students
Iii. other 1. A grey and grey blog:https://liuyueyi.github.io/hexblog
A gray and gray personal blog, recording all the study and work in the blog, welcome everyone to visit
2. Disclaimer
The letter is not as good as, has been on the content, purely opinion, because of limited personal ability, inevitably there are omissions and errors, such as the detection of bugs or better suggestions, welcome criticism, please feel grateful
- Weibo address: small Gray Gray Blog
- QQ: A grey/grey/3302797840
3. Scan for attention
Small grey ash blog& public number
Knowledge Planet
180725-influxdb-v1.6.0 installation and simple use summary