Redis-tool - Little helpers for Redis
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Redis tool Get help on Codementor

Redis-tool is a collection of little node scripts that are helpful if you don't use a GUI like Redsmin.


$ npm install redis-tool -g


### Redis-ztrim
Usage: node ./bin/redis-ztrim [options] pattern start stop

Trim a group of zlists matching `pattern` so that they'll contain only the specified
range of elements specified. Both start and stop are zero-based indexes,
where 0 is the first element of the list with the highest score (the head), 1 the next
element and so on.

For example: redis-ztrim foobar* 0 2 will modify the zsets matching the pattern foobar*
so that only the first three elements of each zsets will remain.

  -p, --preview  preview what is going to be deleted  [boolean]  [default: false]
  -v, --verbose  verbose mode                         [boolean]  [default: false]
  -h, --help     this message.                        [boolean]

Trim all zsets matching the pattern bringr:*:*:ua:*" so that only their members ranked from 0 to 99 will remain.

$ redis-ztrim
✔  bringr:1:121:ua:m   trimmed
✔  bringr:1:121:ua:y   trimmed
✔  bringr:1:123:ua:y   trimmed
✔  bringr:1:123:ua:m   trimmed
✔  bringr:1:121:ua:d   trimmed
✔  bringr:1:123:ua:d   trimmed
✔  bringr:6:93:ua:y    trimmed
✔  bringr:6:93:ua:m    trimmed
✔  bringr:1:123:ua:h   trimmed
✔  bringr:6:93:ua:d    trimmed
[... truncated ... ]
### Redis-zlist-size
Retrieve a list of zset keys via `pattern` and order them by size

Usage: redis-zlist-size [options] pattern

  --json         print results in JSON format  [default: false]
  --graph        generate a Google Graph link  [boolean]  [default: false]
  -v, --verbose  verbose mode                  [boolean]  [default: false]
  -h, --help     this message.                 [boolean]
$ redis-zlist-size "bringr:*:*:ua:*"
bringr:1:121:ua:m     Members   15821544    Size    81660
bringr:1:121:ua:y     Members   15821544    Size    81660
bringr:1:123:ua:y     Members   13782356    Size    66280
bringr:1:123:ua:m     Members   13782356    Size    66280
bringr:1:121:ua:d     Members   13553541    Size    69459
bringr:1:123:ua:d     Members   12080298    Size    58102
bringr:6:93:ua:y      Members   10138538    Size    52129
bringr:6:93:ua:m      Members   10138538    Size    52129
bringr:1:123:ua:h     Members   9192799     Size    44231
bringr:6:93:ua:d      Members   6720535     Size    34702
[... truncated ... ]

Generated pie chart by members count

![Example of generated pie chart by members count](
### Redis-rename
Usage: redis-rename [options] oldPattern newPattern

  -v, --verbose           Verbose mode
  -h, --help              This message.
$ redis-rename -v ns:*:*:k ns:*:*:v
✔  ns:6:43:k → ns:6:43:v
✔  ns:1:121:k → ns:1:121:v
✔  ns:1:119:k → ns:1:119:v
✔  ns:1:121:k → ns:1:121:v
✔  ns:6:108:k → ns:6:108:v
✔  ns:1:121:k → ns:1:121:v
✔  ns:1:120:k → ns:1:120:v
✔  ns:6:90:k → ns:6:90:v
✔  ns:6:93:k → ns:6:93:v
### Redis-dellall
Usage: redis-delall [options] pattern

  -p, --preview           Preview what is going to be deleted
  -v, --verbose           Verbose mode
  -h, --help              This message.
$ redis-delall -v ns:*:*:k
✔  ns:6:43:k deleted
✔  ns:1:121:k deleted
✔  ns:1:119:k deleted
✔  ns:1:121:k deleted
✔  ns:6:108:k deleted
✔  ns:1:121:k deleted
✔  ns:1:120:k deleted
✔  ns:6:90:k deleted
✔  ns:6:93:k deleted


Donate Bitcoins