All Projects → sobotklp → Kubernetes Redis Cluster

sobotklp / Kubernetes Redis Cluster

Redis Cluster on Kubernetes

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Kubernetes Redis Cluster

Lettuce Core
Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.
Stars: ✭ 4,319 (+3862.39%)
Mutual labels:  redis-cluster
Puppet Redis cluster
Install multiple redis instances via Puppet to configure a cluster with redis-trib.rb (for Redis version >= 3.0)
Stars: ✭ 8 (-92.66%)
Mutual labels:  redis-cluster
Flycache
一致性哈希的redis分片存储 (Redis sharding by consistent-hashing)
Stars: ✭ 59 (-45.87%)
Mutual labels:  redis-cluster
Aredis
redis client for Python asyncio (has support for redis server, sentinel and cluster)
Stars: ✭ 576 (+428.44%)
Mutual labels:  redis-cluster
Redis Migrate Tool
A convenient and useful tool for migrating data between redis group.
Stars: ✭ 824 (+655.96%)
Mutual labels:  redis-cluster
Predixy
A high performance and fully featured proxy for redis, support redis sentinel and redis cluster
Stars: ✭ 862 (+690.83%)
Mutual labels:  redis-cluster
Fastoredis
FastoRedis is a crossplatform Redis GUI management tool.
Stars: ✭ 316 (+189.91%)
Mutual labels:  redis-cluster
Phpredis
A PHP extension for Redis
Stars: ✭ 9,203 (+8343.12%)
Mutual labels:  redis-cluster
Redis Py Cluster
Python cluster client for the official redis cluster. Redis 3.0+.
Stars: ✭ 934 (+756.88%)
Mutual labels:  redis-cluster
Docker Redis Cluster
Dockerfile for Redis Cluster (redis 3.0+)
Stars: ✭ 1,035 (+849.54%)
Mutual labels:  redis-cluster
Quick redis blog
QuickRedis is a free forever Redis Desktop manager. It supports direct connection, sentinel, and cluster mode, supports multiple languages, supports hundreds of millions of keys, and has an amazing UI. Supports both Windows, Mac OS X and Linux platform.
Stars: ✭ 594 (+444.95%)
Mutual labels:  redis-cluster
Corvus
A fast and lightweight Redis Cluster Proxy for Redis 3.0
Stars: ✭ 758 (+595.41%)
Mutual labels:  redis-cluster
Docker Redis Cluster
Running a distributed 6-node Redis Cluster with Docker Swarm, Docker Compose, and Supervisor
Stars: ✭ 39 (-64.22%)
Mutual labels:  redis-cluster
Redis Plus Plus
Redis client written in C++
Stars: ✭ 428 (+292.66%)
Mutual labels:  redis-cluster
Spider
基于SSM的爬虫系统,Spring+Spring MVC+MyBatis+Druid+Redis+MQ
Stars: ✭ 78 (-28.44%)
Mutual labels:  redis-cluster
Redis Ui
📡 P3X Redis UI is a very functional handy database GUI and works in your pocket on the responsive web or as a desktop app
Stars: ✭ 334 (+206.42%)
Mutual labels:  redis-cluster
Predis
A flexible and feature-complete Redis client for PHP.
Stars: ✭ 6,966 (+6290.83%)
Mutual labels:  redis-cluster
Nginx Lua Redis Rate Measuring
A lua library to provide distributed rate measurement using nginx + redis, you can use it to do a throttling system within many nodes.
Stars: ✭ 109 (+0%)
Mutual labels:  redis-cluster
Ioredis
🚀 A robust, performance-focused, and full-featured Redis client for Node.js.
Stars: ✭ 9,754 (+8848.62%)
Mutual labels:  redis-cluster
Fastonosql
FastoNoSQL is a crossplatform Redis, Memcached, SSDB, LevelDB, RocksDB, UnQLite, LMDB, ForestDB, Pika, Dynomite, KeyDB GUI management tool.
Stars: ✭ 1,001 (+818.35%)
Mutual labels:  redis-cluster

Redis Cluster on Kubernetes

This k8s module is intended to simplify the creation and operation of a Redis Cluster deployment in Kubernetes.

Requirements

  • Kubernetes 1.5.0+
  • Minikube to run the module locally

How it works

These directions assume some familiarity with Redis Cluster.

When you create the resources in Kubernetes, it will create a 6-member (the minimum recommended size) Stateful Set cluster where the first (0th) member is the master and all other members are slaves. While that's sufficient for getting a cluster up and running, it doesn't distribute cluster slots like you would expect from a real deployment. In addition, automatic failover won't work because the cluster requires at least 2 masters to form a quorum.

Testing it out

If you don't already have Minikube installed, please follow the documentation to set it up on your local machine.

# Start a local Kubernetes cluster
$ minikube start

# Direct kubectl to use Minikube
$ kubectl config use-context minikube

To launch the cluster, have Kubernetes create all the resources in redis-cluster.yml:

$ kubectl create -f redis-cluster.yml
service "redis-cluster" created
configmap "redis-cluster-config" configured
statefulset "redis-cluster" created

Wait a bit for the service to initialize.

Once all the pods are initialized, you can see that Pod "redis-cluster-0" became the cluster master with the other nodes as slaves.

$ kubectl exec -it redis-cluster-0 redis-cli cluster nodes
075293dd82cee03749b983de78cce0ae16b6fc9b 172.17.0.7:6379 slave 4fa0955c6bd58d66ede613bed512a7244c84b34e 0 1468198032209 1 connected
a329f22420fa5ad50184ad8ae4dfcc81092f0e07 172.17.0.5:6379 slave 4fa0955c6bd58d66ede613bed512a7244c84b34e 0 1468198028663 1 connected
ee3e96e11961a24ea705dfdcd53d507bd491a57e 172.17.0.8:6379 slave 4fa0955c6bd58d66ede613bed512a7244c84b34e 0 1468198033717 1 connected
4fa0955c6bd58d66ede613bed512a7244c84b34e 172.17.0.3:6379 myself,master - 0 0 1 connected 0-16383
73c02583f854f65e47a2389419c9a89be3733491 172.17.0.4:6379 slave 4fa0955c6bd58d66ede613bed512a7244c84b34e 0 1468198031701 1 connected
413898a0f8b835e0f8856798300f3451d8211ff4 172.17.0.6:6379 slave 4fa0955c6bd58d66ede613bed512a7244c84b34e 0 1468198032713 1 connected
# Also, you should be able to use redis-cli to connect to a cluster node we just created
$ kubectl exec -t -i redis-cluster-0 redis-cli

To reshard a cluster

When we started the cluster above, we started with only one master that handles all 16384 slots in the cluster. We'll need to repurpose one of our slaves as a master:

# Reset one of the slaves to master
$ kubectl exec -it redis-cluster-2 redis-cli cluster reset soft
# Then rejoin it to the cluster
$ kubectl exec -it redis-cluster-2 redis-cli cluster meet 172.17.0.3 6379

Now that we have another free master in the cluster, let's assign it some shards.

$ docker run --rm -it redis-trib reshard --from f6752d1c571bf7aa6935597aabd9b0c5c47419bf --to f14dc883290304ad1c580e3db473bbffa8d75404 --slots 8192 --yes 172.17.0.4:6379

To clean this mess off your Minikube VM:

# Delete service and statefulset
$ kubectl delete service,statefulsets redis-cluster

# To prevent potential data loss, deleting a statefulset doesn't delete the pods. Gotta do that manually.
$ kubectl delete pod redis-cluster-0 redis-cluster-1 redis-cluster-2 redis-cluster-3 redis-cluster-4 redis-cluster-5

TODO

  • Add documentation for common Redis Cluster operations: adding nodes, resharding, deleting nodes
  • Test some failure scenarios
  • Create a ScheduledJob to do automated backups once this feature is finished.
  • When a pod initializes, use the peer discovery tool to find one or more peers to connect with.
  • Create new Docker image to encapsulate pod initialization logic.
  • Automated 3-master provisioning
  • Make it easier to assign new masters
  • Cluster members should check whether nodes.conf exists and if so, skip pod initialization.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].