npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

redis-proxy

v0.0.7

Published

Proxy for redis servers, to manage redis clusters. Now supports read write splits

Downloads

10

Readme

Redis-proxy

It's like haproxy except for redis.

Why RedisProxy?

Typically for every redis server we setup we have a backup server setup as a slave of the main server.

If the Active Redis crashes or goes down for maintenance, we want the application to seamlessly use(read/write) data from the backup server. But the problem is once the backup takes over as active it will be out of sync with the original(master) and should become the sale of the current active. This is solved by redis-proxy, which proxies the active redis. It is also smart enough to issue slave of commands to machines that start up and make masters slave of no one.

This reduces the common redis slave master replication dance that needs to be done when bad stuff happens or needs maintenance

It is implemented using Node.js because it

Disclaimer

We are in the process of testing it, it works for simple commands, but i have not tested and validated it against the whole set of redis commands. It is likely that commands like Monitor/Pub sub is not working correctly(or at all).

Please consider this alpha software. All help and pull requests/ ideas are appreciated.

Install

Current Mechanism

git clone [email protected]:sreeix/redis-proxy.git

Modify the config.json

node server.js

Unfortunately I have had to make minor modifications to node-redis to support raw commands to redis, so it can't be published to npm as yet. But soon it should be available as an npm module

Scenarios

The standard scenario is each redis has a backup redis.

  • R1 backed by R2

  • R1 is slave of no one.

  • R2 is slave of R1

  • R1 Goes down ** We issue Slave of no one to R2 ** Make R2 the active redis

  • R1 Comes up.

    • We issue Slave of R2 to R1
    • R2 is still the active server
  • R2 Goes down

    • We make R1 Slave of no one
    • R1 is now the active redis.

If Both of them go down together, We just return errors and wait for one of them to come back on.

If no redis is available at startup we raise an exception and stop. (This will change for sure.)

There can be only one master in the system.

There can be multiple slaves. Each will become slave of the master, and on master doing down, one of the slave it randomly picked as master.

Redis-Proxy Stability

Redis proxy can become a single point of failure, If it goes down your redis servers will become inaccessible. There are 2 possible setups

  • Using Nodemon/Forever to keep the redis proxy up all the time
  • Have a backup redis-proxy on Elastic IP or Virtual IP and switch manually or using keepalived.

Limitations /TODOS

  • Benchmarks show 3x drop in performance(Investigating it and will post a fix soon)

  • No support for Monitor and pub/sub commands( There is no reason why this can't be supported)

  • No support for authentication(There is no reason why this can't be supported)

  • Would be nice to have a small ui for showing errors and status of redis servers.

  • It currently only works as master/slave mode. And it's highly unlikely that there could be a switch to sharded mode.

  • Support to pipelined is in the works, but it does not work yet.