Redis相關輔助工具介紹

Hachibye
May 29, 2024

--

Introduction to Redis related auxiliary tools

  1. Redis Insight

docker-compose腳本

version: '3'
services:
redisinsight:
image: redislabs/redisinsight:latest
ports:
- '5540:5540'
volumes:
- ./volumes/:/db

瀏覽器訪問 http://<你的redis主機地址>:5540/ 即可

用途:

  • 查看各個集群狀態
  • 在圖形化介面上可直接輸入redis-cli指令進行查詢

2. Redis-exporter

暴露Redis系統資源的Metrics指標

*可結合Prometheus及Grafana進行監控

docker-compose腳本

version: '2'

services:
redis-exporter:
image: oliver006/redis_exporter:v1.6.0-alpine
ports:
- 9121:9121
command:
- '--redis.addr=<你的redis主機地址>:7001'
- '--redis.password=pass.123'
- '-web.listen-address=0.0.0.0:9121'

Prometheus側寫法

 - job_name: redis_cluster_targets
static_configs:
- targets:
- redis://<你的redis主機地址:端口>
- redis://<你的redis主機地址:端口>
- redis://<你的redis主機地址:端口>
metrics_path: /scrape
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: <你的redis主機地址>:9121
- job_name: redis_cluster
static_configs:
- targets:
- <你的redis主機地址>:9121

用途:

  • 監控Redis集群內資源狀況(最終在Grafana上的呈現)

--

--

Hachibye
Hachibye

Written by Hachibye

字幕組退休勞工 ... DevOps/系統/雲端/資安

No responses yet