Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

push-ioredis

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

push-ioredis

use sentinel + ioredis + sharding logic to replace push-redis-failover

  • 1.0.20
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

push-ioredis

The push-ioredis aims to use redis sentinel(Redis officially) and ioredis to replace redis-failover, which would make our redis cluster high-available and easy to operate.

NOTE THAT THE LIBRARY IS NOT INDEPENDENT, which is a component of push-server. The push-ioredis library relys on:

  • redis master-salves
  • sentinels that watch on these master-salves
  • encapsulated sharding object

Example

node test/t
node test/caller
index.js

Entrance of this library.

lib/redis-failover.js

Implements the redisNodeName-ioredisClient-Dictionary, e.g. ["node_x":"related ioredis instance"]. Create the failover redis obj, which receives the sharding objects as params. Acts as an API.

lib/redisClusterMap.js

Get the node name by the hash value. e.g. return node_1 when receives hash value 4~7.

lib/clientProxy

Implements the sharding logic.

  • Generate the hash value of a key
  • Find the real redis node according to the hash value
  • Use the redis node to do specific operations

config/redisConfig.json

The configuration file for the name of redis nodes and sentinel. The ioredis client get a master node from the sentinel by the name of master-slave pair, the sentinel would guarantee the node that ioredis client gets is a master node.

more redis configuration could be described in redis sentinel.conf, e.g. sentinel_8000.conf

config/redisSharing.json

The configuration file for the cluster sharding. "num" is the number of hash buckets, related to redis-crc, currently is 256(64 nodes, every node has 4 buckets, e.g. if a new inserting key's hashing value is 0~3, it would be inserted in node_0);


test/t.js:

Mainly for testing redis-failover, which is acquiring redis client(master) from sentinel configuration.

test/caller.js:

Exemplify how to use push-ioredis, to testify the failover of redis nodes(sentinel+ioredis) and the logic of sharding(mainly inherits form redis-failover).

test/largeRandomSetGetTest.js:

Test the correctness when high QPS at the same time master-redis down. Currently several master-redis need to be killed manually when this runs.

test/testIndex.js:

Test the redisClient.js

Keywords

FAQs

Package last updated on 13 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc