zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

InfluxDB 时序数据库环境快速搭建部署

数据库部署 环境 快速 搭建 时序 InfluxDB
2023-06-13 09:13:36 时间

[TOC]

Docker 快速部署 InfluxDB 时序数据库

镜像参考: https://hub.docker.com/_/influxdb

1.部署 InfluxDB 1.x

安装部署

  • 步骤 01.准备InfluxDB 1.x配置文件 influxdb.conf , 温馨提示你可以执行如下命令以获取influxdb 1.x 默认配置文件。
# 文件目录创建
mkdir -vp /storage/database/influxdb/{config,data}
# 缺省配置文件
$ docker run --rm influxdb:1.8.10 influxd config > influxdb.conf
# 自定义配置文件
$ tee /storage/database/influxdb/config/influxdb.conf <<'EOF'
[meta]
  dir = "/var/lib/influxdb/meta"
  retention-autocreate = true
  logging-enabled = true

[data]
  dir = "/var/lib/influxdb/data"
  index-version = "inmem"
  wal-dir = "/var/lib/influxdb/wal"
  wal-fsync-delay = "0s"

[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

[retention]
  enabled = true
  check-interval = "30m0s"

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

[subscriber]
  enabled = true
  http-timeout = "30s"
  insecure-skip-verify = false
  ca-certs = ""
  write-concurrency = 40
  write-buffer-size = 1000

[shard-precreation]
  enabled = true
  check-interval = "10m0s"
  advance-period = "30m0s"

[http]
  enabled = true
  bind-address = ":8086"

[logging]
  format = "auto"
  level = "info"
  suppress-logo = false

[[graphite]]
  enabled = true
  bind-address = ":2003" 
  database = "jmeter"
  retention-policy = ""
  protocol = "tcp"
  batch-size = 5000
  batch-pending = 10
  batch-timeout = "1s"
  consistency-level = "one"
  separator = "."
  udp-read-buffer = 0

[continuous_queries]
  log-enabled = true
  enabled = true
  query-stats-enabled = false
  run-interval = "1s"
EOF

温馨提示: 更多 InfluxDB 配置参数讲述请参考 (https://docs.influxdata.com/influxdb/v1.8/administration/config/)

  • 步骤 02.使用InfluxDB 1.x图像运行容器,InfluxDB 镜像暴露了一个共享卷 /var/lib/influxdb,因此您可以将主机目录挂载到该点以访问持久的容器数据。
docker run -p 8086:8086 \
  -p 2003:2003 \
  -v /storage/database/influxdb/config/influxdb.conf:/etc/influxdb/influxdb.conf:ro
  -v /storage/database/influxdb/data:/var/lib/influxdb \
  influxdb:1.8.10 -config /etc/influxdb/influxdb.conf

温馨提示: 上述容器中暴露了以下端口(8086 HTTP API 端口、2003 Graphite 支持(如果已启用))很重要,由 InfluxDB 使用。