使用influx控制台工具操作InfluxDB(2)

> insert students,stuid=s123 score=39 > select * from students name: students time score stuid ---- ----- ----- 1488822338410283027 39 s123 > insert students,stuid=s123 score=99 1488822338410283027 > select * from students name: students time score stuid ---- ----- ----- 1488822338410283027 99 s123 >

删除

格式:

delete from <tbname> [where_clause]

说明:
tbname : 表名称
where_clause : where条件(可选)

删除所有数据:

> delete from students; > select * from students; >

删除指定条件的数据:

> select * from students; name: students time score stuid ---- ----- ----- 1488820352594964019 89 s123 1488820356463338534 79 s123 > delete from students where stuid='s123' and time=1488820352594964019; > select * from students; name: students time score stuid ---- ----- ----- 1488820356463338534 79 s123 >

其它

控制台执行单次查询

格式:

influx -execute '<query>'

类似 mysql -e 的功能,示例代码如下:

[root@localhost ~]# influx -execute 'show databases' name: databases name ---- _internal testdb [root@localhost ~]#

指定查询结果以csv或json格式输出

格式:

influx -format=[format]

说明:

format : 启动格式,支持column,csv,json三种格式,默认为column

示例如下:

[root@localhost ~]# influx -format=csv Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring. Connected to http://localhost:8086 version 1.1.0 InfluxDB shell version: 1.1.0 > show databases; name,name databases,_internal databases,testdb > exit [root@localhost ~]# influx -format=json Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring. Connected to http://localhost:8086 version 1.1.0 InfluxDB shell version: 1.1.0 > show databases; {"results":[{"series":[{"name":"databases","columns":["name"],"values":[["_internal"],["testdb"]]}]}]} > exit [root@localhost ~]# influx -format=json -pretty Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring. Connected to http://localhost:8086 version 1.1.0 InfluxDB shell version: 1.1.0 > show databases; { "results": [ { "series": [ { "name": "databases", "columns": [ "name" ], "values": [ [ "_internal" ], [ "testdb" ] ] } ] } ] }

好,就这些了,希望对你有帮助。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/c903bc7a7f7012451fcd3f58a83ba7c5.html