Prometheus数据持久化Influxdb

1.安装 Influxdb

1.1 下载并安装

下载:https://dl.influxdata.com/influxdb/releases/influxdb-1.5.2.x86_64.rpm
安装:yum install -y influxdb-1.8.1.x86_64.rpm

1.2 启动

systemctl start influxdb 启动
systemctl status influxdb 查看状态
systemctl enable influxdb 开机启动

1.3 配置文件

查看 /usr/bin 目录

命令描述
influxinfluxdb命令行客户端
influxdinfluxdb服务器
influx_inspect查看工具
influx_stress压力测试工具
influx_tsm数据库转换工具(将数据库从b1或bz1格式转换为tsm1格式)

查看 /var/lib/influxdb 目录

目录描述
data存放最终存储的数据,文件以.tsm结尾
meta存放数据库元数据
wal存放预写日志文件

配置文件路径 :/etc/influxdb/influxdb.conf

1.4 创建http接口用于prometheus

在这里插入图片描述

2.修改prometheus配置

vim /opt/prometheus/cfg/prometheus.yml

#Remote write configuration (for Graphite, OpenTSDB, or InfluxDB).
remote_write:
   - url: "http://worker01.prometheus:8086/api/v1/prom/write?db=prometheus"

# Remote read configuration (for InfluxDB only at the moment).
remote_read:
   - url: "http://worker01.prometheus:8086/api/v1/prom/read?db=prometheus"

重启Prometheus:systemctl restart prometheus.service

3.查看Influxdb数据库

[root@worker01 ~]# influx
Connected to http://localhost:8086 version 1.8.1
InfluxDB shell version: 1.8.1
> show databases;
name: databases
name
----
_internal
prometheus
> use prometheus;
Using database prometheus
> show measurements;
......
count_netstat_wait_connections
cup_use_percent_test_metric
go_gc_duration_seconds
go_gc_duration_seconds_count
go_gc_duration_seconds_sum
go_goroutines
go_info
go_memstats_alloc_bytes
go_memstats_alloc_bytes_total
go_memstats_buck_hash_sys_bytes
go_memstats_frees_total
go_memstats_gc_cpu_fraction
go_memstats_gc_sys_bytes
go_memstats_heap_alloc_bytes
go_memstats_heap_idle_bytes
go_memstats_heap_inuse_bytes
go_memstats_heap_objects
go_memstats_heap_released_bytes
go_memstats_heap_sys_bytes
go_memstats_last_gc_time_seconds
go_memstats_lookups_total
go_memstats_mallocs_total
go_memstats_mcache_inuse_bytes
......


4.Grafana配置Influxdb

  1. 选择Influxdb
    在这里插入图片描述
  2. 配置连接信息,数据库
    在这里插入图片描述
    显示模板没有找到,只能自定义模板了。。。

参考:
https://www.cnblogs.com/cheyunhua/p/11376756.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

@TangXin

路漫漫其修远兮,吾将上下而求索

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值