@TOC
redis-exporter部署手册
来源
https://github.com/oliver006/redis_exporter
说明
用于 Redis 指标的 Prometheus 导出器。
兼容 Redis 2.x、3.x、4.x、5.x 和 6.x
部署方式
docker部署
docker run -d --name redis_exporter -p 9121:9121 oliver006/redis_exporter
例如:
docker run -d --name redis_exporter -p 9111:9111 oliver006/redis_exporter --redis.addr redis://172.168.12.70:6379 --redis.password Iyunnan
如果您尝试访问在主机节点上运行的 Redis 实例,则需要添加--network host以便 redis_exporter 容器可以访问它:
docker run -d --name redis_exporter --network host oliver006/redis_exporter
二进制文件部署
下载地址:
https://github.com/oliver006/redis_exporter/releases/download/v1.24.0/redis_exporter-v1.24.0.linux-amd64.tar.gz
解压进入目录下执行./redis_exporter --help 可查看可用配置
部署例子:
nohup ./redis_exporter -redis.addr host:port -redis.password password > redis_exporter.log &
自定义配置
可配置项如下:
Usage of ./redis_exporter:
-check-key-groups string
Comma separated list of lua regex for grouping keys
-check-keys string
Comma separated list of key-patterns to export value and length/size, se arched for with SCAN
-check-keys-batch-size int
Approximate number of keys to process in each execution, larger value sp eeds up scanning.
WARNING: Still Redis is a single-threaded app, huge COUNT can affect pro duction environment. (default 1000)
-check-single-keys string
Comma separated list of single keys to export value and length/size
-check-single-streams string
Comma separated list of single streams to export info about streams, gro ups and consumers
-check-streams string
Comma separated list of stream-patterns to export info about streams, gr oups and consumers, searched for with SCAN
-config-command string
What to use for the CONFIG command (default "CONFIG")
-connection-timeout string
Timeout for connection to Redis instance (default "15s")
-count-keys string
Comma separated list of patterns to count (eg: 'db0=production_*,db3=ses sions:*'), searched for with SCAN
-debug
Output verbose debug information
-export-client-list
Whether to scrape Client List specific metrics
-export-client-port
Whether to include the client's port when exporting the client list. War ning: including the port increases the number of metrics generated and will make your Prometheus server take up more memory
-include-system-metrics
Whether to include system metrics like e.g. redis_total_system_memory_by tes
-is-tile38
Whether to scrape Tile38 specific metrics
-log-format string
Log format, valid options are txt and json (default "txt")
-max-distinct-key-groups int
The maximum number of distinct key groups with the most memory utilizati on to present as distinct metrics per database, the leftover key groups will be aggregated in the 'overflow' bucket (default 100)
-namespace string
Namespace for metrics (default "redis")
-ping-on-connect
Whether to ping the redis instance after connecting
-redis-only-metrics
Whether to also export go runtime metrics
-redis.addr string
Address of the Redis instance to scrape (default "redis://localhost:6379 ")
-redis.password string
Password of the Redis instance to scrape
-redis.password-file string
Password file of the Redis instance to scrape
-redis.user string
User name to use for authentication (Redis ACL for Redis 6.0 and newer)
-script string
Path to Lua Redis script for collecting extra metrics
-set-client-name
Whether to set client name to redis_exporter (default true)
-skip-tls-verification
Whether to to skip TLS verification
-tls-ca-cert-file string
Name of the CA certificate file (including full path) if the server requ ires TLS client authentication
-tls-client-cert-file string
Name of the client certificate file (including full path) if the server requires TLS client authentication
-tls-client-key-file string
Name of the client key file (including full path) if the server requires TLS client authentication
-tls-server-cert-file string
Name of the server certificate file (including full path) if the web int erface and telemetry should use TLS
-tls-server-key-file string
Name of the server key file (including full path) if the web interface a nd telemetry should use TLS
-version
Show version information and exit
-web.listen-address string
Address to listen on for web interface and telemetry. (default ":9121")
-web.telemetry-path string
Path under which to expose metrics. (default "/metrics")