本篇内容介绍了“redis-exporter监控redis的实例分析”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

version: 0.x.x启动步骤

0.x.x版本使用一个exporter监控redis多实例启动方法

1.启动redis_exporter

nohup./redis_exporter-redis.addr=redis://localhost:6379,redis://localhost:6380-web.listen-address:50003&

2.添加prometheus配置(也可添加在自动发现文件中)

-job_name:'redis_exporter'static_configs:-targets:-127.0.0.1:9121

3.重载prometheus配置

curl-XPOSThttp://localhost:9090/-/reloadversion 1.x.x注意事项

1.x版本监控redis多实例启动方式发生了变化,详情参考github中的pr

注意添加 -redis.addr,否则会试图连接本地6379端口

启动步骤

1.启动redis_exporter

[root@test-125redis_exporter-v1.3.4.linux-amd64]#nohup./redis_exporter-redis.addr=-web.listen-address:50003&

2.新建json文件

vim/etc/targets-redis-instances.json[{"targets":["redis://127.0.0.1:6381","redis://127.0.0.1:6378"],"labels":{"redis_env":"TEST"}}]

3.添加prometheus配置

scrape_configs:-job_name:'redis_exporter_targets'file_sd_configs:-files:-targets-redis-instances.jsonmetrics_path:/scraperelabel_configs:-source_labels:[__address__]target_label:__param_target-source_labels:[__param_target]target_label:instance-target_label:__address__replacement:127.0.0.1:9121-job_name:'redis_exporter'static_configs:-targets:-127.0.0.1:9121

4.重载prometheus配置

curl-XPOSThttp://localhost:9090/-/reload

“redis-exporter监控redis的实例分析”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!