项目作者: obukhov

项目描述 :
CLI tool to see redis memory usage by keys in hierarchical way. Think of disk inventory but for redis.
高级语言: Go
项目地址: git://github.com/obukhov/redis-inventory.git
创建时间: 2021-04-15T20:55:13Z
项目社区:https://github.com/obukhov/redis-inventory

开源协议:MIT License

下载


Redis Inventory

Build Status
Coverage Status
Go Report Card
Docker Pulls

Redis inventory is a tool to analyse Redis memory usage by key patterns and displaying it hierarchically. The name is
inspired by “Disk Inventory X” tool doing similar analysis for disk usage.

Blog post explaining how it works

Example:

  1. $ redis-inventory inventory <redis-url> --output=table --output-params="padSpaces=2&depth=2&human=1"

<redis-url> can be provided in one of two formats

Outputs it as a nice table

  1. 12:39PM INF Start scanning
  2. +---------------------+----------+-----------+
  3. | KEY | BYTESIZE | KEYSCOUNT |
  4. +---------------------+----------+-----------+
  5. | dev: | 2.9M | 4,555 |
  6. | article: | 413.7K | 616 |
  7. | blogpost: | 408.5K | 630 |
  8. | collections: | 426.7K | 627 |
  9. | events: | 391.2K | 614 |
  10. | friends:foobar: | 501.1K | 745 |
  11. | news: | 388.8K | 593 |
  12. | user: | 481K | 730 |
  13. | prod: | 2.9M | 4,531 |
  14. | article: | 397.1K | 614 |
  15. | blogpost: | 409.4K | 627 |
  16. | collections: | 374.7K | 560 |
  17. | events: | 384.2K | 588 |
  18. | friends:foobar: | 503K | 755 |
  19. | news: | 407.9K | 618 |
  20. | user: | 492.3K | 769 |
  21. +---------------------+----------+-----------+
  22. 12:39PM INF Finish scanning

It also can render sunburst diagrams to visualize it:

  1. $ redis-inventory inventory <redis-url> --output=chart --maxChildren=100

Full sunburst diagram

Read more about usage

Installation

There are two ways to install the tool:

  • use docker image
  • build binary from sources

Using docker

To run the tool from a docker image, run the command:

  1. docker run --rm dclg/redis-inventory inventory <redis-url>

Read more about installation

Kudos

  • Radix — Redis client for Go,
  • Cobra — CLI applications framework,
  • Go-Pretty — tools to render tables and progress bars,
  • AnyChart — beautiful sunburst diagrams.