Prometheus写入influxDB:中间件remote_storage_adapter

Prometheus写入influxDB:中间件remote_storage_adapter

prometheus默认采用的是本地磁盘做数据存储,本地存储的优势就是运维简单但是缺点就是无法海量的metrics持久化和数据存在丢失的风险,数据写入可能造成wal文件损坏导致采集数据无法再写入的问题。

为了解决单节点存储的限制,prometheus没有自己实现集群存储,而是提供了远程读写的接口,让用户自己选择合适的时序数据库来实现prometheus的扩展性。

Prometheus 提供接口将数据写入到第三方存储系统亦提供接口读取第三方存储系统存储的数据原理如下所示:

接下来我们将node_exporter收集到Prometheus的数据持久化到influxdb数据库中

1.首先我们进入对应网站进行remote_storage_adapte下载:https://download.csdn.net/download/javaee_gao/12451525

2.将下载下来的文件包通过xshell上传到我们需要安装remote_storage_adapte的服务器上,我这里选择的服务器为:

xml 复制代码
[root@localhost Stability]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core)

把程序包放到一个目录下面:

xml 复制代码
[root@localhost Stability]# pwd
/ftp/Stability
[root@localhost Stability]# ll |grep remote
-rw-r--r-- 1 root root 19878504 Mar 19 15:24 remote_storage_adapter
赋予相应的权限:
[root@localhost Stability]# chmod 777 remote_storage_adapter

2.然后我们启动该程序

xml 复制代码
[root@localhost Stability]# nohup ./remote_storage_adapter --influxdb-url=http://127.0.0.1:8086/ --influxdb.database="prometheus" --influxdb.retention-policy=autogen &

3.然后进入prometheus中prometheus.yml文件,使用vim进行编辑,添加如下内容

xml 复制代码
[root@localhost prometheus]# vi prometheus.yml
增加内容如下:
[root@localhost prometheus]# cat prometheus.yml 
# my global config
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).
# 远程写配置
remote_write:
  - url: "http://localhost:9201/write"
  # 配置连接influxdb连接的用户名与密码
    basic_auth:
      username: DGAtest
      password: DGAtest123
# 远程读配置
remote_read:
  - url: "http://localhost:9201/read"
    basic_auth:
      username: DGAtest
      password: DGAtest123

4.重启prometheus服务

xml 复制代码
[root@localhost prometheus]# systemctl restart prometheus

5.查看influxDB中是否有对应的数据信息(实际测试我使用了1.8.4的inflluxdb版本)

xml 复制代码
[root@localhost prometheus]# influx
Connected to http://localhost:8086 version 1.8.4
InfluxDB shell version: 1.8.4
> use prometheus
Using database prometheus
> show measurements
name: measurements
name
----
go_gc_duration_seconds
go_gc_duration_seconds_count
go_gc_duration_seconds_sum
相关推荐
陌殇殇20 小时前
004 Kafka异常处理
中间件·kafka·springboot
Albert Tan1 天前
Oracle Fusion Middleware 12C安装 - 呆瓜式
oracle·中间件·数据库架构
码上淘金2 天前
Prometheus中PodMonitor配置示例
java·prometheus
m0_748254883 天前
docker离线安装及部署各类中间件(x86系统架构)
docker·中间件·系统架构
YGGP4 天前
【Gee】Day5:中间件
中间件·golang
Karoku0664 天前
【CI/CD】CI/CD环境搭建流程和持续集成环境配置
运维·ci/cd·docker·容器·kubernetes·prometheus
jingwang-cs5 天前
内外网隔离文件传输解决方案|系统与钉钉集成+等保合规,安全提升70%
安全·中间件·钉钉·安全架构
WeiLai11125 天前
面试基础--微服务架构:如何拆分微服务、数据一致性、服务调用
java·分布式·后端·微服务·中间件·面试·架构
web135085886355 天前
全面指南:使用JMeter进行性能压测与性能优化(中间件压测、数据库压测、分布式集群压测、调优)
jmeter·中间件·性能优化