Skip to content

Nodejs based utils to deal with large Redis databases

Notifications You must be signed in to change notification settings

kod3r/redis-utils

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Count

Safely counts keys matching a patters on Redis.

Installation

npm install
chmod +x ./count.js

Usage

./count.js [-h] [-p] [--pattern]

Options [default]

  • -h Redis hostname [127.0.0.1]
  • -p Redis port [6379]
  • --pattern Glob pattern [*]

Add Expire

Safely sets expiration for keys matching a patters on Redis. This operation will override any expiration set on the keys.

Installation

npm install
chmod +x ./expire.js

Usage

./expire.js [-h] [-p] [--pattern] [--time]

Options [default]

  • -h Redis hostname [127.0.0.1]
  • -p Redis port [6379]
  • --pattern Glob pattern [*]
  • --time Expiration time in seconds [7776000]

Migrate

Migrates keys matching a pattern from one Redis to another. This procedure involves two scripts:

  1. Download keys and its values matching a pattern from origin Redis.
  2. Upload keys to destination Redis

Be aware that this procedure will remove all expires.

Installation

npm install
chmod +x ./download.js
chmod +x ./upload.js

download.js usage

./download.js [-h] [-p] [--pattern] [--filename]

download.js options [default]

  • -h origin Redis hostname [127.0.0.1]
  • -p origin Redis port [6379]
  • --pattern Glob pattern [*]
  • --filename Filename of the json [dump.json]

upload.js usage

./upload.js [-h] [-p] [--filename]

upload.js options [default]

  • -h destination Redis hostname [127.0.0.1]
  • -p destination Redis port [6379]
  • --filename Filename of the json [dump.json]

Oldest key

Get the oldest idle time.

Installation

npm install
chmod +x ./oldest.js

Usage

./oldest.js [-h] [-p]

Options [default]

  • -h Redis hostname [127.0.0.1]
  • -p Redis port [6379]

About

Nodejs based utils to deal with large Redis databases

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%