# InfluxDB — Scalable Time Series Datastore for Metrics & Events > InfluxDB is a scalable time series database for metrics, events, and real-time analytics. InfluxDB 3.0 is a complete rewrite in Rust with columnar Apache Arrow storage, SQL and InfluxQL queries, and unlimited cardinality. ## Install Save as a script file and run: ## Quick Use ```bash # Docker docker run -d --name influxdb -p 8086:8086 influxdb:3 # Or binary brew install influxdb # macOS # Setup (v3) influxdb3 create token --permission "*" influxdb3 create database metrics ``` Write data via HTTP line protocol: ```bash curl -XPOST "http://localhost:8086/write?db=metrics" \ -H "Authorization: Token $INFLUXDB_TOKEN" \ --data-raw "cpu,host=server01,region=us-west usage_user=23.5,usage_system=12.3 $(date +%s)000000000" ``` Query via SQL (InfluxDB 3): ```sql SELECT host, mean(usage_user) as avg_cpu FROM cpu WHERE time >= now() - INTERVAL "1 hour" GROUP BY host ORDER BY avg_cpu DESC; ``` Or InfluxQL (v1/v2 style): ``` SELECT mean("usage_user") FROM "cpu" WHERE time > now() - 1h GROUP BY time(5m), "host" ``` ## Intro InfluxDB is a scalable time series database for metrics, events, and real-time analytics. InfluxDB 3.0 is a complete rewrite in Rust built on Apache Arrow columnar storage (via DataFusion), providing unlimited cardinality, SQL support, and much better analytics performance than v1/v2. Used by Cisco, eBay, IBM, and countless IoT deployments. - **Repo**: https://github.com/influxdata/influxdb - **Stars**: 31K+ - **Language**: Rust - **License**: Apache 2.0 ## What InfluxDB Does - **Time series storage** — optimized for time-ordered data - **High write throughput** — millions of points per second - **Downsampling** — continuous queries / tasks to roll up data - **Retention policies** — auto-delete old data - **SQL + InfluxQL + Flux** — multiple query languages - **Apache Arrow/Parquet** — columnar storage in v3 - **Unlimited cardinality** — v3 removes series cardinality limits - **Telegraf** — 200+ plugins for data collection - **Kapacitor** — alerting and stream processing - **Grafana integration** — first-class data source ## Architecture InfluxDB 3.0 architecture: - **Write** — line protocol to WAL, flushed to Parquet files - **Query** — DataFusion execution engine on Parquet + in-memory WAL - **Storage** — object storage (S3, local disk) for Parquet - **Compactor** — merges small Parquet files into larger ones ## Self-Hosting ```yaml # docker-compose.yml version: "3" services: influxdb: image: influxdb:3-core ports: ["8086:8086"] volumes: ["influx-data:/var/lib/influxdb3"] environment: INFLUXDB3_NODE_IDENTIFIER_PREFIX: "node-1" INFLUXDB3_OBJECT_STORE: "file" INFLUXDB3_DB_DIR: "/var/lib/influxdb3" volumes: influx-data: ``` ## Key Features - Purpose-built for time series - v3 built on Apache Arrow/Parquet - SQL and InfluxQL query - Unlimited cardinality (v3) - High ingest throughput - Downsampling and retention - Telegraf ecosystem (200+ plugins) - Grafana integration - Cloud-native managed offering ## Comparison | Database | Model | Storage | SQL | |---|---|---|---| | InfluxDB v3 | Time series | Parquet + Arrow | Yes + InfluxQL | | TimescaleDB | Postgres extension | Postgres | Native | | Prometheus | Time series | Local TSDB | PromQL only | | VictoriaMetrics | Time series | Custom | MetricsQL | | QuestDB | Time series | Columnar | SQL | | ClickHouse | OLAP | Columnar | SQL | ## 常见问题 FAQ **Q: v2 vs v3 区别?** A: v3 完全重写(Rust + Apache Arrow/DataFusion),支持 SQL、无 cardinality 限制、storage 放对象存储。v2 是 Go + TSM 引擎,有 cardinality 问题。 **Q: 和 Prometheus 怎么选?** A: Prometheus 适合监控(pull 模型、简单部署);InfluxDB 适合通用时序数据(push 模型、SQL 查询、更长期存储)。 **Q: 支持 PromQL 吗?** A: v3 有实验性 PromQL 支持,目标是 Prometheus 替代品。 ## 来源与致谢 Sources - Docs: https://docs.influxdata.com - GitHub: https://github.com/influxdata/influxdb - License: Apache 2.0 --- Source: https://tokrepo.com/en/workflows/90136b66-35f6-11f1-9bc6-00163e2b0d79 Author: Script Depot