Dealing with large databases on Redis is quite painful so we build these utils that are based on the SCAN operation so they will not block your database. We will continue adding new operations as soon as we find it necessary. Feel free to report any bugs or contribute with new operations.
Safely counts keys matching a patters on Redis.
npm install
chmod +x ./count.js
./count.js [-h] [-p] [-a] [-t] [--pattern]
-h
Redis hostname [127.0.0.1]-p
Redis port [6379]-a
Redis auth ['']-t
Redis TLS [false]-n
Redis db [1]--pattern
Glob pattern [*]
Safely sets expiration for keys matching a patters on Redis. This operation will override any expiration set on the keys.
npm install
chmod +x ./expire.js
./expire.js [-h] [-p] [-a] [-t] [--pattern] [--time]
-h
Redis hostname [127.0.0.1]-p
Redis port [6379]-a
Redis auth ['']-t
Redis TLS [false]--pattern
Glob pattern [*]--time
Expiration time in seconds [7776000]
Migrates keys matching a pattern from one Redis to another. This procedure involves two scripts:
- Download keys and its values matching a pattern from origin Redis.
- Upload keys to destination Redis
Be aware that this procedure will remove all expires.
npm install
chmod +x ./download.js
chmod +x ./upload.js
./download.js [-h] [-p] [-a] [-t] [-n ][--pattern] [--filename]
-h
origin Redis hostname [127.0.0.1]-p
origin Redis port [6379]-a
origin Redis auth ['']-t
origin Redis TLS [false]-n
origin Redis db [1]--pattern
Glob pattern [*]--filename
Filename of the json [dump.json]
./upload.js [-h] [-p] [-a] [-t] [-n] [--filename]
-h
destination Redis hostname [127.0.0.1]-p
destination Redis port [6379]-a
destination Redis auth ['']-t
destination Redis TLS [false]-n
origin Redis db [1]--filename
Filename of the json [dump.json]
Get the oldest idle time.
npm install
chmod +x ./oldest.js
./oldest.js [-h] [-p] [-a] [-t]
-h
Redis hostname [127.0.0.1]-p
Redis port [6379]-a
Redis auth ['']-t
Redis TLS [false]