y1新建cluster集群redis

一、准备

y1的kubeconfig(脱敏)

yaml 复制代码
apiVersion: v1
kind: Config
clusters:
- name: "yumc1-middleware"
  cluster:
    server: "https://ksrancher.hwwt2.com/k8s/clusters/c-4nmx8"
- name: "yumc1-middleware-172.25.148.232"
  cluster:
    server: "https://172.25.148.232:6443"
    certificate-authority-data: "xxx"
- name: "yumc1-middleware-172.25.148.231"
  cluster:
    server: "https://172.25.148.231:6443"
    certificate-authority-data: "xxx"
- name: "yumc1-middleware-172.25.148.233"
  cluster:
    server: "https://172.25.148.233:6443"
    certificate-authority-data: "xxx"

users:
- name: "yumc1-middleware"
  user:
    token: "xxx"

contexts:
- name: "yumc1-middleware"
  context:
    user: "yumc1-middleware"
    cluster: "yumc1-middleware"
- name: "yumc1-middleware-172.25.148.232"
  context:
    user: "yumc1-middleware"
    cluster: "yumc1-middleware-172.25.148.232"
- name: "yumc1-middleware-172.25.148.231"
  context:
    user: "yumc1-middleware"
    cluster: "yumc1-middleware-172.25.148.231"
- name: "yumc1-middleware-172.25.148.233"
  context:
    user: "yumc1-middleware"
    cluster: "yumc1-middleware-172.25.148.233"

current-context: "yumc1-middleware"
  1. redis yaml文件

cluster模式的redis yaml文件

yaml 复制代码
apiVersion: cache.tongdun.net/v1alpha1
kind: RedisCluster
metadata:
  name: redis-cluster-cpos-01  
  namespace: redis
spec:
  app: cluster-cpos-01  # 取name中redis-* 后的值, pod之间共享资源根据该标签
  capacity: 8192
  dc: sh
  env: production
  image: harbor.hwwt2.com/ops/redis-cluster:latest
  monitorimage: harbor.hwwt2.com/ops/redis-exporter:latest
  netmode: ClusterIP
  proxyimage: ""      # 原项目代理密码 废弃
  proxysecret: ""     # 原项目代理密码 废弃
  realname: dba 
  secret: 'TKYdUe7pfT'          # redis密码设置 可以为空
  size: 3             # 初始redis集群主节点 也是slot分段数量  单台节点最高容量32GB 所以如128GB,就是至少为4
  storageclass: ""    # 目前都是本地盘
  vip: ""             # 暂时废弃
  labels:              
    plt: cpos
    sid: "1115"
    srv: cpos-redis-cluster-gray 

注意:

Image 和 monitorimage ,y0和y1不是一样,需要注意。

y1_k8s image: harbor.hwwt2.com/ops/redis-cluster:latest monitorimage: harbor.hwwt2.com/ops/redis-exporter:latest
y0_k8s image: harbor.hwwt2.com/ops/redis-cluster:test0.3monitorimage: harbor.hwwt2.com/ops/redis-exporter:paas1.0

HA模式的redis yaml文件

yaml 复制代码
apiVersion: cache.tongdun.net/v1alpha1
kind: RedisStandby
metadata:
  name: redis-standby-kfc-storeinfo
  namespace: redis
spec:
  app: standby-kfc-storeinfo
  capacity: 8192   # redis容量
  dc: sh
  env: production
  image: harbor.hwwt2.com/ops/op-redis-5.0.9:v2
  monitorimage: harbor.hwwt2.com/ops/redis-exporter:paas1.0
  netmode: ClusterIP
  realname: dba
  secret: '2ghlmvl_AP'
  sentinelimage: harbor.hwwt2.com/ops/sentinel-standby:v1
  storageclass: ''
  vip: ''
  labels:              # 百胜云监控需要的标签
    plt: ecselection
    sid: "1005"
    srv: ecselection-redis-kfc-storeinfo
---
  1. git信息

redis的yaml文件记录在git中

code.hwwt2.com/osc/_source...

rancher地址

ksrancher.hwwt2.com/p/c-4nmx8:p...

二、操作

查询已有的redis

ini 复制代码
# 
kubectl --kubeconfig=yumc1_k8s get RedisCluster -n redis
  1. 创建 redis(apply)

ini 复制代码
# cpos 是redis yaml文件
kubectl --kubeconfig=yumc1_k8s apply -f cpos
  1. 验证

ini 复制代码
# 查看创建的 redis-cluster-cpos-01 资源
kubectl --kubeconfig=yumc1_k8s get RedisCluster -n redis

在rancher上验证

三、补充

  1. 最小规格

分片:8G,三分片。

  1. 规格套餐
  2. 白皮书
  3. 删除操作
ini 复制代码
# 删除redis-cluster-cpos01 资源
kubectl --kubeconfig=yumc1_k8s delete RedisCluster redis-cluster-cpos01 -n redis
相关推荐
专注API从业者1 小时前
Python + 淘宝 API 开发:自动化采集商品数据的完整流程
大数据·运维·前端·数据挖掘·自动化
烛阴2 小时前
TypeScript高手密技:解密类型断言、非空断言与 `const` 断言
前端·javascript·typescript
样子20183 小时前
Uniapp 之renderjs解决swiper+多个video卡顿问题
前端·javascript·css·uni-app·html
Nicholas683 小时前
flutterAppBar之SystemUiOverlayStyle源码解析(一)
前端
黑客飓风3 小时前
JavaScript 性能优化实战大纲
前端·javascript·性能优化
emojiwoo5 小时前
【前端基础知识系列六】React 项目基本框架及常见文件夹作用总结(图文版)
前端·react.js·前端框架
张人玉5 小时前
XML 序列化与操作详解笔记
xml·前端·笔记
杨荧5 小时前
基于Python的宠物服务管理系统 Python+Django+Vue.js
大数据·前端·vue.js·爬虫·python·信息可视化
YeeWang6 小时前
🎉 Eficy 让你的 Cherry Studio 直接生成可预览的 React 页面
前端·javascript
gnip6 小时前
Jenkins部署前端项目实战方案
前端·javascript·架构