ucloud / redis-operator Goto Github PK
View Code? Open in Web Editor NEWRedis operator build a Highly Available Redis cluster with Sentinel atop Kubernetes
License: Apache License 2.0
Redis operator build a Highly Available Redis cluster with Sentinel atop Kubernetes
License: Apache License 2.0
对于类似 Codis 这样的集群架构来说,缓存资源是一组组 m-s,扩容缩容的粒度为一组组 m-s,如果使用 k8s 部署 Codis 这样的架构,就需要动态添加 master 节点。
经过了解,ucloud 的 redis-operator 一个sentinel 集群仅支持一个 master,后续有没有考虑增加这个特性呢?
增加对rename-command的支持
I have a 3 node redis cluster. all 3 redis pods are ready, one sentinel pod exists is has 'Readiness probe failed: PONG'
in the sentinel pod
redis-cli -h $(hostname) -p 26379 info sentinel
# Sentinel
sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
sentinel_simulate_failure_flags:0
master0:name=mymaster,status=ok,address=10.244.2.28:6379,slaves=1,sentinels=1
slaves=1
The readiness check fails if slaves <= 1
I have been using your operator since a couple of weeks without issues
Until yesterday, it was just fine, but during the troubleshooting I decided to resize the cluster and see if this would help somehow.
As the documentation says, I modified the RedisCluster resource to 5 nodes. The cluster resized, but the number of sentinel instances is at 3 and isn't changing.
According to the features given for this operator, the number of worker nodes scales with the number of sentinel nodes, and this isn't happening.
Any workaround? It's safe to scale the statefulset to 5?
Thanks for reading
下面是我的yaml
apiVersion: redis.kun/v1beta1
kind: RedisCluster
metadata:
name: test
annotations:
redis.kun/scope: "cluster-scoped"
namespace: default
spec:
image: redis:5.0.4-alpine
resources:
limits:
cpu: 400m
memory: 300Mi
requests:
cpu: 50m
memory: 30Mi
size: 3
storage:
persistentVolumeClaim:
claimName: redis-data-claim
这种固定pvc的格式可以用嘛,应该如何写呢,感谢
Currently there is no image available for this operator on Docker Hub and we must build it locally before using.
k8s version 1.22 removes the apiregistration.k8s.io/v1beta1
apiVersion which the CRD for the operator relies on. Are there plans to release an updated CRD to work with this version of Kubernetes?
https://kubernetes.io/docs/reference/using-api/deprecation-guide/#customresourcedefinition-v122
Hi! Thanks for the operator!
I would like to start using it, but came across a show stopper, in which the failover is not happening and the cluster is left leaderless for a while.
Here are the steps:
redis-cluster-test-2
.cpu requests
, it terminates redis-cluster-test-2
and does an instant failover to the IP of redis-cluster-test-0
or redis-cluster-test-1
. So far so good.redis-cluster-test-1
, the sentinel service keeps pointing to that IP until both redis-cluster-test-1
and redis-cluster-test-0
have been recreated (about 80s)redis-cluster-test-0
, then redis-cluster-test-1
gets recreated, and the sentinel keeps pointing to the IP of redis-cluster-test-0
. When ``redis-cluster-test-0` gets recreated, the sentinel keeps pointing to the old IP until the recreation is complete and a few seconds more (about 40s).During this time the Redis cluster is leaderless and any writes fail because the sentinels are still pointing to an IP that is no longer in use.
In other words, the failover is only being forced on the first pod to be terminated, which, in a statefulset is pod -2
.
Can you please help @polefishu ?
Thanks!
What's the function of Headless service in redis-cluster?
$ kubectl explain rediscluster
KIND: RedisCluster
VERSION: redis.kun/v1beta1
DESCRIPTION:
The current implementation just allows a password to be set by specifying it as plain-text. It would be great to have something similar to passwordSecret
of https://github.com/ucloud/redis-cluster-operator.
https://github.com/ucloud/redis-cluster-operator/blob/master/deploy/example/custom-password.yaml
host addr not found
hostname -i
hostname: redis-cluster-xxxx-n: Host not found
I see that the for size the minimum limit is set to 3.
Why it is not working if I change the default to 1 to bring up a cluster?
What is the reason behind minimum 3 masters and 1 slave each master.
Hi there .
spotahome.redis-operator (https://github.com/spotahome/redis-operator) can let the container run the command just config the command option.
So here can I change the default command ? I mean the docker entrypoint .
之前看到自己版本的版本你是1.23的,官方并没有维护到这里,部署的yaml版本都老了,所以v1.22以及以上的版本都没有办法使用,这里简单修复了一下yaml,可以使用了:
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: redisclusters.redis.kun
spec:
group: redis.kun
names:
kind: RedisCluster
listKind: RedisClusterList
plural: redisclusters
singular: rediscluster
scope: Namespaced
versions:
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
affinity:
type: object
command:
items:
type: string
type: array
config:
additionalProperties:
type: string
type: object
disablePersistence:
type: boolean
exporter:
properties:
enabled:
type: boolean
image:
type: string
type: object
image:
type: string
password:
type: string
maxLength: 48
resources:
type: object
securityContext:
type: object
sentinel:
description: Sentinel defines its cluster settings
properties:
affinity:
type: object
command:
items:
type: string
type: array
customConfig:
items:
type: string
type: array
image:
type: string
replicas:
format: int32
type: integer
resources:
type: object
securityContext:
type: object
tolerations:
items:
type: object
type: array
type: object
shutdownConfigMap:
type: string
size:
format: int32
type: integer
minimum: 3
maximum: 10
storage:
properties:
emptyDir:
type: object
keepAfterDeletion:
type: boolean
persistentVolumeClaim:
type: object
type: object
toleRations:
items:
type: object
type: array
type: object
status:
properties:
conditions:
description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
of cluster Important: Run "operator-sdk generate k8s" to regenerate
code after modifying this file Add custom validation using kubebuilder
tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html'
items:
properties:
lastTransitionTime:
description: Last time the condition transitioned from one status
to another.
type: string
lastUpdateTime:
description: The last time this condition was updated.
type: string
message:
description: A human readable message indicating details about
the transition.
type: string
reason:
description: The reason for the condition's last transition.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Status of cluster condition.
type: string
required:
- type
- status
type: object
type: array
masterIP:
type: string
sentinelIP:
type: string
type: object
subresources:
status: {}
additionalPrinterColumns:
- jsonPath: .spec.size
description: The number of Redis node in the ensemble
name: Size
type: integer
- jsonPath: .status.conditions[].type
description: The status of Redis Cluster
name: Status
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
我是两个salve 一个master, 而service 会指向集群的第一个pod,而master在第二个
Operator should support change password of an existing redis cluster.
We need to synchronize data in redis instances across multiple regions, so we developed a program as a fake slave node of master in region A. The fake slave fetch RDB file and subsequent commands from the master redis in region A, and then parse RDB into redis commands and execute them on redis in region B to achieve the purpose of cross-region synchronization.
As described above, we need redis sentinels in region A to ignore the fake slave when checking the count and status of the slaves, and we make the fake slave runid begin with "fake_slave_" for easily filter out. Thanks.
Now the cluster's cache is used to distinguish between different operations and update status, which is not necessary.
I'm experiencing the same issue outlined here here
whenever i make changes to the cluster resources (changing cpu/memory limits) all of the pods get killed and data is lost.
can you give us option to set IfNotPresent
in RedisCluster
YAML ?
Hi, we having issues while accessing redis svc when istio side car running on the redis pods. Can we include options for adding annotations to ignore running side car, We generally do that today by adding the below annotations but I'm not seeing we can add this option at distributedrediscluster yaml. It would be great if we can have the below feature.
sidecar.istio.io/inject: "true"
@polefishu
I see that the for size the minimum limit is set to 3. Will it work if I change the default to 2 and bring up a cluster? For test/staging we may not need 3 rredia replicas.
I do understand that the sentine minimum l count has to be 3.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.