跳到主要内容
版本:Next

Vector

写入数据

配置

创建一个名为 vector.toml 的文件,并将以下内容复制到其中。

[sources.in]
type = "host_metrics"
scrape_interval_secs = 5

[sinks.greptime]
inputs = ["in"]
type = "greptimedb"
endpoint = "greptimedb:4001"
dbname = "public"

该配置将 host_metrics 作为 Vector 源,并使用本地 GreptimeDB 作为接收端。endpoint 地址中的 greptimedb 是 Docker 网络中 GreptimeDB 的服务名。

启动服务

我们使用 Docker Compose 启动 GreptimeDB、Vector 和 Grafana。首先创建一个名为 docker-compose.yml 的文件,将以下内容复制到其中:

services:
grafana:
image: grafana/grafana-oss:<%grafana-version%>
container_name: grafana
ports:
- 3000:3000

greptime:
image: greptime/greptimedb:<%greptimedb-version%>
container_name: greptimedb
ports:
- 4000:4000
- 4001:4001
- 4002:4002
- 4003:4003
command: "standalone start --http-addr 0.0.0.0:4000 --rpc-addr 0.0.0.0:4001 --mysql-addr 0.0.0.0:4002 --postgres-addr 0.0.0.0:4003"
volumes:
- ./greptimedb:/tmp/greptimedb

vector:
image: timberio/vector:<%vector-version%>
container_name: vector
ports:
- 8686:8686
volumes:
- ./vector.toml:/etc/vector/vector.toml:ro

networks: {}

然后执行以下命令:

docker-compose up

当所有服务成功启动后,主机指标将被收集并发送到 GreptimeDB。

Visualize Data with Grafana

Next Steps