Coder Social home page Coder Social logo

ucloud / redis-operator Goto Github PK

View Code? Open in Web Editor NEW
210.0 12.0 66.0 8.04 MB

Redis operator build a Highly Available Redis cluster with Sentinel atop Kubernetes

License: Apache License 2.0

Dockerfile 0.85% Makefile 0.80% Shell 0.59% Go 97.76%
redis-sentinel kubernetes operator

redis-operator's People

Contributors

gaopenghigh avatar polefishu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redis-operator's Issues

Feature:希望支持动态增加 master 节点

对于类似 Codis 这样的集群架构来说,缓存资源是一组组 m-s,扩容缩容的粒度为一组组 m-s,如果使用 k8s 部署 Codis 这样的架构,就需要动态添加 master 节点。
经过了解,ucloud 的 redis-operator 一个sentinel 集群仅支持一个 master,后续有没有考虑增加这个特性呢?

sentinel : Readiness probe failed: PONG

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

Resizing cluster doesn't resize sentinel statefulset

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

存储persistent不用sc不行嘛

下面是我的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的格式可以用嘛,应该如何写呢,感谢

Docker Hub Image

Currently there is no image available for this operator on Docker Hub and we must build it locally before using.

Failover happens differently with different pods

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:

  1. I created a cluster with 3 pods. The master has been allocated to the IP of pod redis-cluster-test-2.
  2. When I change a pod spec variable like 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.
  3. Then one of two things occur:
    3A. If the master became the IP of 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)
    3B. If the master became the IP of 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!

没有crd describe嘛

$ kubectl explain rediscluster
KIND: RedisCluster
VERSION: redis.kun/v1beta1

DESCRIPTION:

关于集群版本是1.2x及以上的crd修复

之前看到自己版本的版本你是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

Ignore slave whose runid begin with "fake_slave_"

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.

remove cluster cache

Now the cluster's cache is used to distinguish between different operations and update status, which is not necessary.

Add scope to ignore istio side car

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

哨兵镜像如何更改

image
wo我在这里定义了镜像。但是发现哨兵的镜像没有被更改,只有redis 主从镜像更改了。这里需要单独配置哨兵字段么。
如图还是5.0.4 的。
image

Will 2 redis replicas work instead of 3?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.