Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
redis-sentinel-client
Advanced tools
Supplements node_redis with Redis Sentinel support.
From the Sentinel docs:
Redis Sentinel is a system designed to help managing Redis instances. It performs the following three tasks:
Monitoring. Sentinel constantly check if your master and slave instances are working as expected.
Notification. Sentinel can notify the system administrator, or another computer program, via an API, that something is wrong with one of the monitored Redis instances.
Automatic failover. If a master is not working as expected, Sentinel can start a failover process where a slave is promoted to master, the other additional slaves are reconfigured to use the new master, and the applications using the Redis server informed about the new address to use when connecting.
This was originally part of a fork of node_redis, and has been subsequently split to its own module. (However, it still currently requires changes to node_redis to work, so it still depends on the fork.)
See related thread about different approaches to Sentinel support: https://github.com/mranney/node_redis/issues/302
RedisClient
npm install redis-sentinel-client
var RedisSentinel = require('redis-sentinel-client');
var sentinelClient = RedisSentinel.createClient(options);
// or
var sentinelClient = RedisSentinel.createClient(PORT, HOST);
Now use sentinelClient
as a regular client: set
, get
, hmset
, etc.
masterName
: Which master the sentinel is listening to. Defaults to 'mymaster'. (If a sentinel is listening to multiple masters, create multiple SentinelClients
.)logger
: pass in winston or another custom logger, otherwises uses console. (Expects a log
method.)debug
: verbose output (to logger
about internal ops)getMaster()
: returns a reference to the sentinel client's activeMasterClient
(also available directly)reconnect()
: used on instantiation and on psub events, this checks if the master has changed and connects to the new master.send_command()
(and any other RedisClient
command): command is passed to the master client.sentinel message
(msg
): passed up from the sentinel's channel listener. Note, messages can be about other masters, does not differentiate.failover-start
: corresponds to sentinel's +failover-triggered
message.failover-end
: corresponds to sentinel's +failover-end
message.disconnected
: old master disconnected.reconnected
(newMasterClient
): new master reconnected. (In theory should be instant swapover, so no lag.) Passes new client ref for convenience.
error
(error
): An error occured. (Currently does not differentiate errors in different components.) Will fire errors during a failover, before new master is connected.There are currently 2 tests, run with Mocha:
npm test
../node_modules/.bin/mocha --ui tdd --reporter spec --bail test/test-failover
RedisClient
, SentinelClient
is not / does not need to be a streamcreateClient()
won't be compatible.multi
support, unknown status.Created by the Node.js team at DocuSign (in particular Ben Buckman and Derek Bredensteiner).
MIT
FAQs
Transparent Redis Sentinel client
We found that redis-sentinel-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.