Influxdb 快速入门
从Docker启动 Influxdb
docker pull influxdb:LATEST
docker run -d --name influxdb -p 8086:8086
-v /opt/work/influxdb:/var/lib/influxdb
influxdb
进入Influxdb的Client
# docker exec -it influxdb influx
Connected to http://localhost:8086 version 1.8.3
InfluxDB shell version: 1.8.3
>create database flink # 创建Flink数据库
>use flink #为FLink创建RETENTION_POLICY(1)
>CREATE RETENTION POLICY one_hour ON flink DURATION 1h REPLICATION 1 #为FLink创建RETENTION_POLICY(2)
配置Flink
修改FLINK_CONF
metrics.reporter.influxdb.class: org.apache.flink.metrics.influxdb.InfluxdbReporter
metrics.reporter.influxdb.host: <IP>
metrics.reporter.influxdb.port: 8086
metrics.reporter.influxdb.db: flink
metrics.reporter.influxdb.username:
metrics.reporter.influxdb.password:
metrics.reporter.influxdb.retentionPolicy: one_hour
以该配置启动的Flink作业,Flink会自动将指标写入Influxdb
【可选】安装Chronograf可视化界面
docker pull chronograf:LATEST
docker run --name chronograf -d -p 8888:8888 -v /opt/work/chronograf:/var/lib/chronograf chronograf
执行SQL可以查到CheckpointExternalPath
SELECT * FROM "flink"."one_hour"."jobmanager_job_lastCheckpointExternalPath"