influxdb自学入门(一)

这篇博客介绍了开源时序数据库InfluxDB的基本概念、特性,详细讲解了从下载解压到启动服务,以及配置文件修改的过程,并提到了如何创建和管理用户。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Influxdb:

定义:

InfluxDB 开源的分布式时序、时间和指标数据库,使用go语言编写,无需外部依赖 ,用于处理海量写入与负载查询。其中几乎所有的数据都可以打上一个Timestamp字段。时间序列数据的更重要的一个属性是如何去查询它,包括数据的过滤,计算等等。

三大特性:
  1. 时序性(Time Series): 与时间相关的函数的灵活使用(诸如最大、最小、求和等)
  2. 度量(Metrics):对实时大量数据进行计算
  3. 事件(Event):支持任意的事件数据,换句话说,任意事件的数据我们都可以做操作
几大特点:
  1. schemaless(无结构),可以是任意数量的列;
  2. min, max, sum, count, mean, median 一系列函数,方便统计;
  3. Native HTTP API, 内置http支持,使用http读写;
  4. Powerful Query Language 类似sql;
  5. Built-in Explorer 自带管理工具。
目前流行的TSDB:

在这里插入图片描述

下载解压:

在这里插入图片描述

influx.exe 命令行客户端

influxd.exe 服务器

influxdb.conf 配置文件

可修改配置:
含义注释配置
元数据存放位置#Where the metadata/raft database is storeddir = “/var/lib/influxdb/meta”
创建数据库时自动创建默认保留策略。#Automatically create a default retention policy when creating a database.#retention-autocreate = true
是否为元数据打印日志#If log messages are printed for the meta service#logging-enabled = true
TSM存储引擎存储TSM文件的目录。#The directory where the TSM storage engine stores TSM files.dir = “/var/lib/influxdb/data”
TSM存储引擎存储WAL文件的目录。#The directory where the TSM storage engine stores WAL files.wal-dir = “/var/lib/influxdb/wal”
#query-log-enabled = true
确定是否启用保留策略强制。#Determines whether retention policy enforcement enabled.#enabled = true
运行保留策略强制检查的时间间隔。#The interval of time when retention policy enforcement checks run.#check-interval = “30m”
确定是否启用碎片预创建服务。#Determines whether shard pre-creation service is enabled.#enabled = true
#预创建新碎片的检查运行的时间间隔。#The interval of time when the check to pre-create new shards runs.#check-interval = “10m”
#在创建其后续组的碎片组的结束时间之前的默认时间段。#The default period ahead of the endtime of a shard group that its successor group is created.#advance-period = “30m”
是否内部记录统计数据。#Whether to record statistics internally.#store-enabled = true
用于记录统计信息的目标数据库#The destination database for recorded statistics#store-database = “_internal”
记录统计数据的间隔#The interval at which to record statistics#store-interval = “10s”
admin部分
确定是否启用HTTP终结点#Determines whether HTTP endpoint is enabled.# enabled = true
HTTP服务使用的绑定地址#The bind address used by the HTTP service.# bind-address = “:8086”
初次启动:

进入到influxdb目录,执行命令:influx.exe -config influxdb.conf即可开启influxdb服务,同时按照上面配置文件产生相应的文件。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4uzNmI1j-1595211123846)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\1595171759606.png)]

新建文件夹存放数据:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-RgPZtjM6-1595211123848)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\1595210313959.png)]

修改配置为新建文件夹路径:

#Where the metadata/raft database is stored.

dir = "E:\influxDB\influxdb-1.7.3_windows_amd64\influxdb-1.7.3-1\meta"

#The directory where the TSM storage engine stores TSM files.

dir = "E:\influxDB\influxdb-1.7.3_windows_amd64\influxdb-1.7.3-1\data"

#The directory where the TSM storage engine stores WAL files.

wal-dir = "E:\influxDB\influxdb-1.7.3_windows_amd64\influxdb-1.7.3-1\wal"

path环境变量新增一条:

E:\influxDB\influxdb-1.7.3_windows_amd64\influxdb-1.7.3-1

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-v2LbB1IA-1595211123853)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\1595210398915.png)]

启动与使用:
  1. cmd 运行influxd命令启动服务器:
    在这里插入图片描述

  2. 再打开一个cmd 运行influx命令启动客户端:
    在这里插入图片描述

  3. 尝试以下命令:

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

这里要注意单双引号:

在这里插入图片描述

删除用户mzf,重新创建 一个有所有权限的用户:

在这里插入图片描述

  1. 再打开一个cmd,使用新创建的用户:
    在这里插入图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值