天天看点

influxDB系列(三)influxDB配置文件详解

全局配置

reporting-disabled = false  # 该选项用于上报influxdb的使用信息给InfluxData公司,默认值为false
bind-address = ":8088"  # 备份恢复时使用,默认值为8088
           

1、meta相关配置

[meta]
dir = "/var/lib/influxdb/meta"  # meta数据存放目录
retention-autocreate = true  # 用于控制默认存储策略,数据库创建时,会自动生成autogen的存储策略,默认值:true
logging-enabled = true  # 是否开启meta日志,默认值:true
           

2、data相关配置

[data]
  # The directory where the TSM storage engine stores TSM files.
  dir = "/var/lib/influxdb/data"

  # The directory where the TSM storage engine stores WAL files.
  wal-dir = "/var/lib/influxdb/wal"

  # The amount of time that a write will wait before fsyncing.  A duration
  # greater than 0 can be used to batch up multiple fsync calls.  This is useful for slower
  # disks or when WAL write contention is seen.  A value of 0s fsyncs every write to the WAL.
  # Values in the range of 0-100ms are recommended for non-SSD disks.
  # wal-fsync-delay = "0s"


  # The type of shard index to use for new shards.  The default is an in-memory index that is
  # recreated at startup.  A value of "tsi1" will use a disk based index that supports higher
  # cardinality datasets.
  # index-version = "inmem"

  # Trace logging provides more verbose output around the tsm engine. Turning
  # this on can provide more useful output for debugging tsm engine issues.
  # trace-logging-enabled = false

  # Whether queries should be logged before execution. Very useful for troubleshooting, but will
  # log any sensitive data contained within a query.
  # query-log-enabled = true

  # Validates incoming writes to ensure keys only have valid unicode characters.
  # This setting will incur a small overhead because every key must be checked.
  # validate-keys = false

  # Settings for the TSM engine

  # CacheMaxMemorySize is the maximum size a shard's cache can
  # reach before it starts rejecting writes.
  # Valid size suffixes are k, m, or g (case insensitive, 1024 = 1k).
  # Values without a size suffix are in bytes.
  # cache-max-memory-size = "1g"

  # CacheSnapshotMemorySize is the size at which the engine will
  # snapshot the cache and write it to a TSM file, freeing up memory
  # Valid size suffixes are k, m, or g (case insensitive, 1024 = 1k).
  # Values without a size suffix are in bytes.
  # cache-snapshot-memory-size = "25m"

  # CacheSnapshotWriteColdDuration is the length of time at
  # which the engine will snapshot the cache and write it to
  # a new TSM file if the shard hasn't received writes or deletes
  # cache-snapshot-write-cold-duration = "10m"

  # CompactFullWriteColdDuration is the duration at which the engine
  # will compact all TSM files in a shard if it hasn't received a
  # write or delete
  # compact-full-write-cold-duration = "4h"

  # The maximum number of concurrent full and level compactions that can run at one time.  A
  # value of 0 results in 50% of runtime.GOMAXPROCS(0) used at runtime.  Any number greater
  # than 0 limits compactions to that value.  This setting does not apply
  # to cache snapshotting.
  # max-concurrent-compactions = 0

  # CompactThroughput is the rate limit in bytes per second that we
  # will allow TSM compactions to write to disk. Note that short bursts are allowed
  # to happen at a possibly larger value, set by CompactThroughputBurst
  # compact-throughput = "48m"

  # CompactThroughputBurst is the rate limit in bytes per second that we
  # will allow TSM compactions to write to disk.
  # compact-throughput-burst = "48m"

  # If true, then the mmap advise value MADV_WILLNEED will be provided to the kernel with respect to
  # TSM files. This setting has been found to be problematic on some kernels, and defaults to off.
  # It might help users who have slow disks in some cases.
  # tsm-use-madv-willneed = false

  # Settings for the inmem index

  # The maximum series allowed per database before writes are dropped.  This limit can prevent
  # high cardinality issues at the database level.  This limit can be disabled by setting it to
  # 0.
  # max-series-per-database = 1000000

  # The maximum number of tag values per tag that are allowed before writes are dropped.  This limit
  # can prevent high cardinality tag values from being written to a measurement.  This limit can be
  # disabled by setting it to 0.
  # max-values-per-tag = 100000

  # Settings for the tsi1 index

  # The threshold, in bytes, when an index write-ahead log file will compact
  # into an index file. Lower sizes will cause log files to be compacted more
  # quickly and result in lower heap usage at the expense of write throughput.
  # Higher sizes will be compacted less frequently, store more series in-memory,
  # and provide higher write throughput.
  # Valid size suffixes are k, m, or g (case insensitive, 1024 = 1k).
  # Values without a size suffix are in bytes.
  # max-index-log-file-size = "1m"

  # The size of the internal cache used in the TSI index to store previously 
  # calculated series results. Cached results will be returned quickly from the cache rather
  # than needing to be recalculated when a subsequent query with a matching tag key/value 
  # predicate is executed. Setting this value to 0 will disable the cache, which may
  # lead to query performance issues.
  # This value should only be increased if it is known that the set of regularly used 
  # tag key/value predicates across all measurements for a database is larger than 100. An
  # increase in cache size may lead to an increase in heap usage.
  series-id-set-cache-size = 100
           

3、coordinator查询管理的配置选项

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

4、retention旧数据的保留策略

[retention]
enabled = true  # 是否启用该模块,默认值 : true
check-interval = "30m"  # 检查时间间隔,默认值 :"30m"
           

5、shard-precreation分区预创建

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

6、monitor 控制InfluxDB自有的监控系统。 默认情况下,InfluxDB把这些数据写入_internal 数据库,如果这个库不存在则自动创建。 _internal 库默认的retention策略是7天,如果你想使用一个自己的retention策略,需要自己创建。

[monitor]
store-enabled = true  # 是否启用该模块,默认值 :true
store-database = "_internal"  # 默认数据库:"_internal"
store-interval = "10s  # 统计间隔,默认值:"10s"
           

7、admin web管理页面

[admin]
enabled = true  # 是否启用该模块,默认值 : false
bind-address = ":8083"  # 绑定地址,默认值 :":8083"
https-enabled = false  # 是否开启https ,默认值 :false
https-certificate = "/etc/ssl/influxdb.pem"  # https证书路径,默认值:"/etc/ssl/influxdb.pem"
           

8、http API

[http]
enabled = true  # 是否启用该模块,默认值 :true
bind-address = ":8086"  # 绑定地址,默认值:":8086"
auth-enabled = false  # 是否开启认证,默认值:false
realm = "InfluxDB"  # 配置JWT realm,默认值: "InfluxDB"
log-enabled = true  # 是否开启日志,默认值:true
write-tracing = false  # 是否开启写操作日志,如果置成true,每一次写操作都会打日志,默认值:false
pprof-enabled = true  # 是否开启pprof,默认值:true
https-enabled = false  # 是否开启https,默认值:false
https-certificate = "/etc/ssl/influxdb.pem"  # 设置https证书路径,默认值:"/etc/ssl/influxdb.pem"
https-private-key = ""  # 设置https私钥,无默认值
shared-secret = ""  # 用于JWT签名的共享密钥,无默认值
max-row-limit = 0  # 配置查询返回最大行数,0无限制,默认值:0
max-connection-limit = 0  # 配置最大连接数,0无限制,默认值:0
unix-socket-enabled = false  # 是否使用unix-socket,默认值:false
bind-socket = "/var/run/influxdb.sock"  # unix-socket路径,默认值:"/var/run/influxdb.sock"
           

9、subscriber 控制Kapacitor接受数据的配置

[subscriber]
enabled = true  # 是否启用该模块,默认值 :true
http-timeout = "30s"  # http超时时间,默认值:"30s"
insecure-skip-verify = false  # 是否允许不安全的证书
ca-certs = ""  # 设置CA证书
write-concurrency = 40  # 设置并发数目,默认值:40
write-buffer-size = 1000  # 设置buffer大小,默认值:1000
           

10、graphite 相关配置

[[graphite]]
enabled = false  # 是否启用该模块,默认值 :false
database = "graphite"  # 数据库名称,默认值:"graphite"
retention-policy = ""  # 存储策略,无默认值
bind-address = ":2003"  # 绑定地址,默认值:":2003"
protocol = "tcp"  # 协议,默认值:"tcp"
consistency-level = "one"  # 一致性级别,默认值:"one
batch-size = 5000  # 批量size,默认值:5000
batch-pending = 10  # 配置在内存中等待的batch数,默认值:10
batch-timeout = "1s"  # 超时时间,默认值:"1s"
udp-read-buffer = 0  # udp读取buffer的大小,0表示使用操作系统提供的值,如果超过操作系统的默认配置则会出错。 该配置的默认值:0
separator = "."  # 多个measurement间的连接符,默认值: "."
           

11、collectd

[[collectd]]
enabled = false  # 是否启用该模块,默认值 :false
bind-address = ":25826"  # 绑定地址,默认值: ":25826"
database = "collectd"  # 数据库名称,默认值:"collectd"
retention-policy = ""  # 存储策略,无默认值
typesdb = "/usr/local/share/collectd"  # 路径,默认值:"/usr/share/collectd/types.db"
auth-file = "/etc/collectd/auth_file"
batch-size = 5000
batch-pending = 10
batch-timeout = "10s"
read-buffer = 0  # udp读取buffer的大小,0表示使用操作系统提供的值,如果超过操作系统的默认配置则会出错。默认值:0
           
[[opentsdb]]
enabled = false  # 是否启用该模块,默认值:false
bind-address = ":4242"  # 绑定地址,默认值:":4242"
database = "opentsdb"  # 默认数据库:"opentsdb"
retention-policy = ""  # 存储策略,无默认值
consistency-level = "one"  # 一致性级别,默认值:"one"
tls-enabled = false  # 是否开启tls,默认值:false
certificate= "/etc/ssl/influxdb.pem"  # 证书路径,默认值:"/etc/ssl/influxdb.pem"
log-point-errors = true  # 出错时是否记录日志,默认值:true
batch-size = 1000
batch-pending = 5
batch-timeout = "1s"
           
[[udp]]
enabled = false  # 是否启用该模块,默认值:false
bind-address = ":8089"  # 绑定地址,默认值:":8089"
database = "udp"  # 数据库名称,默认值:"udp"
retention-policy = ""  # 存储策略,无默认值
batch-size = 5000
batch-pending = 10
batch-timeout = "1s"
read-buffer = 0  # udp读取buffer的大小,0表示使用操作系统提供的值,如果超过操作系统的默认配置则会出错。 该配置的默认值:0 
           
[continuous_queries]
enabled = true  # enabled 是否开启CQs,默认值:true
log-enabled = true  # 是否开启日志,默认值:true
run-interval = "1s"  # 时间间隔,默认值:"1s"