influxdb2

环境配置

环境

版本

端口

配置文件或挂载卷

docker

27.3.1

docker compose

2.29.7

influxdb

2.7

8086

influxdb2-data:

influxdb2-config:

docker run 部署

docker run -d --name influxdb \
  --restart always \
  -p 8086:8086 \
  -v influxdb2-data:/var/lib/influxdb2 \
  -v influxdb2-config:/etc/influxdb2 \
  -e DOCKER_INFLUXDB_INIT_MODE=setup \
  -e DOCKER_INFLUXDB_INIT_USERNAME=admin \
  -e DOCKER_INFLUXDB_INIT_PASSWORD=password \
  -e DOCKER_INFLUXDB_INIT_ORG=influx \
  -e DOCKER_INFLUXDB_INIT_BUCKET=influx \
  -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=Eing5yaew6ujoo9ohd3saeH6neeshei3 \
  influxdb:2.7

docker compose 部署

官方文档:https://docs.influxdata.com/influxdb/v2/install/use-docker-compose/

# vim docker-compose.yaml

services:
  influxdb:
    image: influxdb:2.7
    container_name: influxdb
    environment:
      DOCKER_INFLUXDB_INIT_MODE: setup
      DOCKER_INFLUXDB_INIT_USERNAME: admin
      DOCKER_INFLUXDB_INIT_PASSWORD: password
      DOCKER_INFLUXDB_INIT_ORG: influx
      DOCKER_INFLUXDB_INIT_BUCKET: influx
      DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: Eing5yaew6ujoo9ohd3saeH6neeshei3
    volumes:
      - influxdb2-data:/var/lib/influxdb2
      - influxdb2-config:/etc/influxdb2
    ports:
      - 8086:8086
    restart: always
volumes:
  influxdb2-data:
  influxdb2-config:

influxdb 3-core

环境配置

环境

版本

端口

配置文件或挂载卷

docker

27.3.1

docker compose

2.29.7

influxdb

3-core

8181

--data-dir=/var/lib/influxdb3/data

--plugin-dir=/var/lib/influxdb3/plugins

docker run部署

# File system object store with Docker 
# Create a mount
# Provide the mount path
docker run -it \
 --volume /path/on/host:/path/in/container \
 influxdb:3-core influxdb3 serve \
 --node-id my_host \
 --object-store file \
 --data-dir /path/in/container

docker compose部署

官方文档:https://docs.influxdata.com/influxdb3/core/get-started/setup/#docker-compose-with-a-mounted-file-system-object-store

# compose.yaml
services:
  influxdb3-core:
    image: influxdb:3-core
    ports:
      - 8181:8181
    command:
      - influxdb3
      - serve
      - --node-id=node0
      - --object-store=file
      - --data-dir=/var/lib/influxdb3/data
      - --plugin-dir=/var/lib/influxdb3/plugins
    volumes:
      - type: bind
        # Path to store data on your host system
        source: ~/.influxdb3/data
        # Path to store data in the container
        target: /var/lib/influxdb3/data
      - type: bind
        # Path to store plugins on your host system
        source: ~/.influxdb3/plugins
        # Path to store plugins in the container
        target: /var/lib/influxdb3/plugins