1.wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.4.x86_64.rpm
或者从 influxdb-1.8.4.x86_64.rpm-其它文档类资源-CSDN下载
中下载
2.安装:sudo yum localinstall influxdb-1.8.4.x86_64.rpm
3.修改配置;
vim /etc/influxdb/influxdb.conf
找到 [http] 的地方
去掉 enabled = true 前面的 #
去掉 bind-address = ":8086" 前面的 #
保存退出
4.
启动服务:
service influxdb start
5.启动客户端:
连接数据库:
influx -precision rfc3339
参数:-precision为设置显示时间格式,如果没有设置,返回的时间类型字段显示为时间戳,使用rfc3339返回的时间格式为:2020-05-12T16:37:53.189100300Z
简单连接也可以直接输入influx
6.创建数据库:
6.1创建数据库
create database gyye_test;
6.2创建用户
Use gyye_test;
create user gjptest with password 'gjptest%123' with all privileges
7.数据库基本操作:
在新数据库查看导入数据:
- 查看所有数据库:show databases;
- 查看所有表:show measurements;
- 查看表中数据:select * from students;
- 创建数据库:create database gyye_test;
执行结果:
insert <tbname>,<tags> <values> [timestamp]
说明:
tbname : 数据表名称
tags : 表的tag域
values : 表的value域
timestamp :当前数据的时间戳(可选,没有提供的话系统会自带添加)
实例:
删除表
drop measurement <tbname>
说明:
tbname : 数据表名称
8.数据文件导入和导出
Infuxdb 数据导出:
influx_inspect export
-datadir "/data/influxdb/data" # 勿动,influxdb 默认的数据存储位置
-waldir "/data/influxdb/wal" # 勿动,influxdb 默认的数据交换位置
-out "telemetry_vcdu_time" # 导出数据文件的文件名
-database telemetry_vcdu_time # 指定要导出数据的数据库
-start 2019-07-21T08:00:01Z # 指定要导出的数据的起始时间
实例:
G:\zhizaozhongxin\influxdb-1.7.1-1>influx_inspect.exe export -datadir "C:/Users/gjp/.influxdb/data" -waldir "C:/Users/gjp/.influxdb/wal" -out "gyye_test1" -database gyye_test
Infuxdb 数据导入:
influx
-import # 无参,勿动
-path=telemetry_sat_time # 指定导入数据的文件
-precision=ns # 指定导入数据的时间精度
influx -import -path=gyye_test1 -precision=ns
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)