K8S部署redis-cluster-operator

开源地址

https://github.com/ucloud/redis-cluster-operator

一、概述

Redis Cluster Operator用于管理基于k8s的Redis Cluster
该operator基于Operator framework之上(https://github.com/operator-framework/operator-sdk)

每个master node和slave node由一个statefulset管理,每个statefulset创建一个headless svc, 所有的node创建一个clusterIP service。

每个statefulset使用PodAntiAffinity来确保master和slave部署在不同的node上。同时,当operator在一个statefulset上选择master时,他优先选择不同k8s nodes上的pod作为master。

二、Features

自定义master nodes的数量和replica nodes的数量
Password
安全地扩容Redis Cluster
备份和恢复
持久化卷
自定义配置
Prometheus发现

三、使用redis-cluster-operator

3.1、部署一个redis cluster operator

注册CRD(Custom Resource Definition):

$ kubectl create -f deploy/crds/redis.kun_distributedredisclusters_crd.yaml
$ kubectl create -f deploy/crds/redis.kun_redisclusterbackups_crd.yaml

关键配置:

masterSize:
format: int32
type: integer
minimum: 3
maximum: 10
clusterReplicas:
format: int32
type: integer
minimum: 1
maximum: 3
serviceName:
type: string
pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'

CRD的生命周期包括namespace和cluster,cluster > namespace:

// cluster-scoped
$ kubectl create -f deploy/service_account.yaml
$ kubectl create -f deploy/cluster/cluster_role.yaml
$ kubectl create -f deploy/cluster/cluster_role_binding.yaml
$ kubectl create -f deploy/cluster/operator.yaml// namespace-scoped
$ kubectl create -f deploy/service_account.yaml
$ kubectl create -f deploy/namespace/role.yaml
$ kubectl create -f deploy/namespace/role_binding.yaml
$ kubectl create -f deploy/namespace/operator.yaml

这样查看redis-cluster-operator是否运行:

$ kubectl get deployment
NAME                     READY   UP-TO-DATE   AVAILABLE   AGE
redis-cluster-operator   1/1     1            1           1d

部署一个redis cluster:

$ kubectl apply -f deploy/example/redis.kun_v1alpha1_distributedrediscluster_cr.yaml

扩容Redis Cluster:

apiVersion: redis.kun/v1alpha1
kind: DistributedRedisCluster
metadata:annotations:# if your operator run as cluster-scoped, add this annotationsredis.kun/scope: cluster-scopedname: example-distributedrediscluster
spec:# Increase the masterSize to trigger the scaling.masterSize: 4ClusterReplicas: 1image: redis:5.0.4-alpine

缩容Redis Cluster:

apiVersion: redis.kun/v1alpha1
kind: DistributedRedisCluster
metadata:annotations:# if your operator run as cluster-scoped, add this annotationsredis.kun/scope: cluster-scopedname: example-distributedrediscluster
spec:# Increase the masterSize to trigger the scaling.masterSize: 3ClusterReplicas: 1image: redis:5.0.4-alpine

K8S operator方式部署redis-cluster相关推荐

  1. 基于Redis6.2.6版本部署Redis Cluster集群

    基于Redis6.2.6版本部署Redis Cluster集群 文章目录 基于Redis6.2.6版本部署Redis Cluster集群 1.Redis6.2.6简介以及环境规划 2.二进制安装Red ...

  2. k8s 安装redis-operator并以operator方式部署redis-standalone redis-cluster集群完整操作记录

    安装redis-operator install.sh [root@linux:redis-operator]$ cat install.sh #!/usr/bin/env bash# This sc ...

  3. K8S StatefulSet方式部署elasticsearch集群 —— 筑梦之路

    直接上yaml内容 # es-cluster.yaml apiVersion: apps/v1 # 设置控制器 kind: StatefulSet metadata:name: es-clustern ...

  4. 小米Redis的K8s容器化部署实践

    本文讲述了小米是如何将Redis Cluster部署在K8S上提供高质量的服务的 往期文章回顾:HBase Region Read Replicas功能详解 背景 Why K8S How K8s Wh ...

  5. k8s部署redis集群

    K8S部署Redis Cluster集群 kubernetes部署单节点redis: https://www.cnblogs.com/zisefeizhu/p/14282299.html Redis ...

  6. 小米 Redis 的 K8S 容器化部署实践

    背景 Why K8S How K8s Why Proxy Proxy带来的问题 K8s带来的好处 遇到的问题 总结 背景 小米的Redis使用规模很大,现在有数万个实例,并且每天有百万亿次的访问频率, ...

  7. Redis进阶-5.x 单节点 及Redis Cluster 3主3从集群部署

    文章目录 Redis 下载地址 Redis 5.x 单节点 编译安装 Redis 启停 Redis Cluster 4.x VS Redis Cluster 5.x 演进之路 ( Master/Sla ...

  8. Redis Cluster 集群部署

    2.4:Redis Cluster 部署 2.4.1:部署 Redis Cluster 的前提 时间同步: Redis Node 均采用相同的硬件配置.相同的密码.相同的 Redis 版本: Redi ...

  9. redis分布式方案redis cluster的介绍和实践

    简要介绍 redis cluster是redis官方提供的分布式解决方案.主要作用有两点: 将数据根据分区规则分布到不同的redis节点上,降低单个redis节点的读写压力. 内置提供高可用支持,集群 ...

最新文章

  1. 你真的会vue-router吗?
  2. 常见拒绝服务攻击行为特征与防御方法
  3. 利用位运算和指针实现的交换两个数的程序
  4. python之人脸识别
  5. 成功解决AttributeError: module 'tensorflow.python.training.training' has no attribute 'SummaryWriter'
  6. Intel Realsense 如何获取已连接所有摄像头的序列号参数?context() query_devices() size() camera_info device_list
  7. 计算机删除等级列在哪里,插入与删除Excel表格的单元格、行和列
  8. #ifndef, #define, #endif的作用
  9. Appium+Python之PO模型(Page object Model)
  10. 2.4 sklearn中的metrics.roc_auc_score评价指标
  11. python信息安全书籍_2018年信息安全从业者书单推荐
  12. java等额本金、等额本息计算
  13. python中怎么统计英文字符的个数_Python之每日一练统计英文文本单词出现的个数、行数、字符数...
  14. ViewData、ViewBag和 TempData
  15. Windows内核--Rtl字符串API “不同IRQL“(3.2)
  16. linux c python,Python 不是 C
  17. 计算机常用程序在DOS中的英文名
  18. 解决nvcc显示不是内部或外部命令的问题
  19. Panic的概念和使用
  20. android Java 笔试考题

热门文章

  1. Linux学习笔记(三)|Vim编辑器
  2. 编译原理笔录(1)-编译程序基本构成
  3. 【机器学习基础】用Python画出几种常见机器学习二分类损失函数
  4. 【论文解读】一种基于时间卷积网络的知识驱动股票趋势预测方法
  5. 【论文解读】这篇顶会paper,讲述了疫情期间憋疯的你和我
  6. 抢人饭碗了!推荐一款全自动的机器学习建模神器PyCaret
  7. 推荐搜索炼丹笔记:SIM 用户行为序列点击率预估模型
  8. 怎么把PDF文件空白页删除
  9. 集合数百个常用工具类集合,V2.3.10.104
  10. SpringBoot中oauth2.0学习之服务端配置快速上手