Skip to content
Nodejs based utils to deal with large Redis databases
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
add-expire
count
migrate
oldest-key
.gitignore
readme.md

readme.md

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] [-a] [-t] [--pattern]

Options [default]

  • -h Redis hostname [127.0.0.1]
  • -p Redis port [6379]
  • -a Redis auth ['']
  • -t Redis TLS [false]
  • --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] [-a] [-t] [--pattern] [--time]

Options [default]

  • -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]

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] [-a] [-t] [--pattern] [--filename]

download.js options [default]

  • -h origin Redis hostname [127.0.0.1]
  • -p origin Redis port [6379]
  • -a origin Redis auth ['']
  • -t origin Redis TLS [false]
  • --pattern Glob pattern [*]
  • --filename Filename of the json [dump.json]

upload.js usage

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

upload.js options [default]

  • -h destination Redis hostname [127.0.0.1]
  • -p destination Redis port [6379]
  • -a destination Redis auth ['']
  • -t destination Redis TLS [false]
  • --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] [-a] [-t]

Options [default]

  • -h Redis hostname [127.0.0.1]
  • -p Redis port [6379]
  • -a Redis auth ['']
  • -t Redis TLS [false]
You can’t perform that action at this time.