Skip to main content

Redis Cluster with Some Features

Project description

A Redis cluster for when single points of failure leave you flustered.

Overview

Redis Fluster is a very limited Redis pool/cluster implementation that makes sharding simple for a few common use cases.

Quickstart

import redis
from fluster import FlusterCluster
cluster = FlusterCluster([redis.Redis(6379), redis.Redis(6380)])

while True:
  for key in ('foo', 'bar'):
    try:
      client = cluster.get_client(key)
      client.incr(key, 1)
      client.get(key)
    except ConnectionError:
      client = cluster.get_client(key)
      client.incr(key, 1)
      client.get(key)
  time.sleep(1)

Limited, how? I want to use this for everything!

Simply put, don’t. Fluster maintains a pool of connections to various Redis instances and will return a connection to one based on a shard key provided. If one goes down, it gets put in a penalty box until it comes back up, at which point it’s usable again.

At not point are keys duplicated, nor are they redistributed when nodes drop/join. If you’re writing INCR statements and the node goes down, now you’re writing them to another instance. Once the original instance returns, you’ve got two sets of values for the same key. This will be seamless and your program won’t crash, so maybe that’s enough.

Then what’s it good for?

Caches and ephemeral data. The ideal case is where going down is worse than duplicated data. If a Redis fluster node goes down and you’ve got two copies of a cache, this probably isn’t a problem. You’ve set expiries on the data, right?

Likewise, if you’re using lists to distribute a queue to multiple Redis instances, then one dropping and joining isn’t a problem. Items queued while it was down went elsewhere and if your workers read from all available instances, then nothing has been lost, or is really all that different.

What about Redis Cluster?

Looks great! Unfortunately, it’s very new and not ready for production use. With all due luck, that will achieve all its promise and this project can quietly fade away.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fluster-0.0.4.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

fluster-0.0.4-py2.py3-none-any.whl (15.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fluster-0.0.4.tar.gz.

File metadata

  • Download URL: fluster-0.0.4.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fluster-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a74ac7330c266e280461f0cbf0582884caba6a0b13ced079ba1fc7a493893d48
MD5 1fb0d1db386ea94f0aa0b93950d4f096
BLAKE2b-256 29d4a7f50ab4718b659c2a15fbf6867bff10e278dc245c771c415c9f28e8a006

See more details on using hashes here.

Provenance

File details

Details for the file fluster-0.0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fluster-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f547e94dd0e146df67bc0675e9e127b456bd44e908c18c8ff4327f4d4adccb10
MD5 19c6bb3ed54e4cb34670d98af5a84046
BLAKE2b-256 56af843fcdba9872aefe971d76c408930b26ea19c26489477cbaabdf79720043

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page