Skip to content

官方文档

https://docs.influxdata.com/influxdb/v1.7/administration/config/

0. 配置文件

默认配置文件安装目录为: /etc/influxdb/influxdb.conf

默认配置查看

infuxd config
infuxd config

1.全局配置

参数说明
reporting-disabled = false该选项用于上报influxdb的使用信息给InfluxData公司,默认值为false,将此选项设置为true将禁用报告
bind-address = "127.0.0.1:8088"备份恢复时使用,默认值为8088

2.meta相关配置

[meta]
dir = "/var/lib/influxdb/meta"
retention-autocreate = true
logging-enabled = true
[meta]
dir = "/var/lib/influxdb/meta"
retention-autocreate = true
logging-enabled = true
参数说明
dir = "/var/lib/influxdb/meta"存储元数据/ raft数据库的目录
retention-autocreate用于控制默认存储策略,数据库创建时,会自动生成autogen的存储策略,默认值:true
logging-enabled为元服务打印日志消息,默认值:true

3.data


[data]
dir = "/var/lib/influxdb/data"
wal-dir = "/var/lib/influxdb/wal"
wal-fsync-delay = = "0s"
index-version = "inmem"
trace-logging-enabled = false
query-log-enabled = true
cache-max-memory-size = 1048576000  
cache-snapshot-memory-size = 26214400
cache-snapshot-write-cold-duration = "10m"
compact-full-write-cold-duration = "4h" 
max-series-per-database = 1000000  
max-values-per-tag = 100000  
compact-throughput = "48m"
compact-throughput-burst = "48m"
max-index-log-file-size = "1m"
max-series-per-database = 1000000
max-values-per-tag = 100000
tsm-use-madv-willneed = false

[data]
dir = "/var/lib/influxdb/data"
wal-dir = "/var/lib/influxdb/wal"
wal-fsync-delay = = "0s"
index-version = "inmem"
trace-logging-enabled = false
query-log-enabled = true
cache-max-memory-size = 1048576000  
cache-snapshot-memory-size = 26214400
cache-snapshot-write-cold-duration = "10m"
compact-full-write-cold-duration = "4h" 
max-series-per-database = 1000000  
max-values-per-tag = 100000  
compact-throughput = "48m"
compact-throughput-burst = "48m"
max-index-log-file-size = "1m"
max-series-per-database = 1000000
max-values-per-tag = 100000
tsm-use-madv-willneed = false
参数说明
dir = "/var/lib/influxdb/data"最终数据(TSM文件)存储目录
wal-dir = "/var/lib/influxdb/wal"预写日志存储目录
wal-fsync-delay = = "0s"写入在fsyncing之前等待的时间。 持续时间大于0可用于批量处理多个fsync调用。 这对于较慢的磁盘或看到WAL写入争用时很有用。 每次写入WAL时值为0s fsyncs。 对于非SSD磁盘,建议使用0-100ms范围内的值
index-version = "inmem"用于新分片的分片索引的类型。 默认值是在启动时重新创建的内存中索引。 值“tsi1”将使用支持更高的基于磁盘的索引基数数据集
trace-logging-enabled = false是否开启跟踪(trace)日志,默认值:false
query-log-enabled = true是否开启tsm引擎查询日志,默认值: true
cache-max-memory-size = 1048576000用于限定shard最大值,大于该值时会拒绝写入,默认值:1000MB,单位:byte
cache-snapshot-memory-size = 26214400用于设置快照大小,大于该值时数据会刷新到tsm文件,默认值:25MB,单位:byte
cache-snapshot-write-cold-duration = "10m"tsm引擎 snapshot写盘延迟,默认值:10Minute
compact-full-write-cold-duration = "4h"tsm文件在压缩前可以存储的最大时间,默认值:4Hour
max-series-per-database限制数据库的级数,该值为0时取消限制,默认值:1000000
max-values-per-tag一个tag最大的value数,0取消限制,默认值:100000
compact-throughput是我们允许TSM压缩写入磁盘的速率限制(以字节/秒为单位)。 请注意,短脉冲串允许以可能更大的值发生,由Compact-Throughput-Burst设置,默认值:48m
compact-throughput-burst是我们允许TSM压缩写入磁盘的速率限制,以每秒字节数为单位,默认值:48m
max-index-log-file-size索引预写日志文件压缩到索引文件中时的阈值(以字节为单位)。 较小的大小将导致日志文件更快地压缩,并导致较低的堆使用量,但代价是写入吞吐量。 更高的大小将更少压缩,在内存中存储更多系列,并提供更高的写入吞吐量。有效大小的后缀为k,m或g(不区分大小写,1024 = 1k)。没有大小后缀的值以字节为单位,默认值:1m
max-series-per-database限制数据库的级数,该值为0时取消限制,默认值:1000000
tsm-use-madv-willneed如果为true,则将针对TSM文件向内核提供mmap建议值MADV_WILLNEED。 已发现此设置在某些内核上存在问题,默认值:false。 在某些情况下,它可能会帮助磁盘速度较慢的用户

4.coordinator

#控制群集服务配置
[coordinator]
write-timeout = "10s" 
max-concurrent-queries = 0
query-timeout = "0s" 
log-queries-after = "0s"
max-select-point = 0 
max-select-series = 0
max-select-buckets = 0
#控制群集服务配置
[coordinator]
write-timeout = "10s" 
max-concurrent-queries = 0
query-timeout = "0s" 
log-queries-after = "0s"
max-select-point = 0 
max-select-series = 0
max-select-buckets = 0
参数说明
write-timeout写操作超时时间,默认值: 10s
max-concurrent-queries最大并发查询数,0无限制,默认值: 0
query-timeout查询操作超时时间,0无限制,默认值:0s
log-queries-after慢查询超时时间,0无限制,默认值:0s
max-select-pointselect语句可以处理的最大点数(points),0无限制,默认值:0。
max-select-seriesselect语句可以处理的最大级数(series),0无限制,默认值:0。
max-select-bucketsselect语句可以处理的最大"GROUP BY time()"的时间周期,0无限制,默认值:0

5.retention

[retention]
enabled = true
check-interval = "30m0s"
[retention]
enabled = true
check-interval = "30m0s"
参数说明
enabled是否启用该模块,默认值 : true。
check-interval检查时间间隔,默认值 :“30m”

6.shard-precreation

#分区预创建
[shard-precreation]
enabled = true
check-interval = "10m"
advance-period = "30m"
#分区预创建
[shard-precreation]
enabled = true
check-interval = "10m"
advance-period = "30m"
参数说明
enabled是否启用该模块,默认值 : true。
check-interval检查时间间隔,默认值 :“10m”。
advance-period预创建分区的最大提前时间,默认值 :30m

7.admin忽略

[admin]
忽略
[admin]
忽略

8.monitor

[monitor]
store-enabled = true
store-database = "_internal"
store-interval = "10s"
[monitor]
store-enabled = true
store-database = "_internal"
store-interval = "10s"

9.http

influxdb的http接口配置

[http]
enabled = true
flux-enabled = false
bind-address = ":8086"
auth-enabled = false
realm = "InfluxDB"
log-enabled = true
suppress-write-log = false
[http]
enabled = true
flux-enabled = false
bind-address = ":8086"
auth-enabled = false
realm = "InfluxDB"
log-enabled = true
suppress-write-log = false

10.subscriber

11.graphite

12.collectd

13.OpenTSDB

14.upd

15.continuous_queries

16.tls

https://www.cnblogs.com/yinfutao/p/11618892.html

https://docs.influxdata.com/influxdb/v1.7/administration/config/#monitoring-settings

#优化

https://zyun.360.cn/blog/?p=862

https://www.jianshu.com/p/85ab62aaac70

https://blog.51cto.com/u_536410/5399323