赞
踩
redis-configmap.yaml
- apiVersion: v1
- kind: ConfigMap
- metadata:
- name: jumpredis6379.conf
- namespace: prod
- data:
- redis.conf: |
- #pid文件
- pidfile "/data/redis-6379.pid"
- #端口
- port 6379
- tcp-backlog 1024
- timeout 0
- tcp-keepalive 0
- #日志提醒级别
- loglevel notice
- #日志文件路径
- logfile "/data/info-6379.log"
- databases 16
- #日志刷新策略
- save 900 100
- #说明900秒内1次改动,自动保存一次数据
- #save 300 10
- #save 60 10000
- #若持久化失败时,继续禁止写操作
- stop-writes-on-bgsave-error no
- #以rdb方式存储时是否压缩
- rdbcompression yes
- #rdb是否校验
- rdbchecksum yes
- #数据文件名
- dbfilename "dump-6379.rdb"
- #数据文件路径
- dir "/data"
- replica-serve-stale-data yes
- #指定与主数据库连接时需要的密码验证,主库无需设置
- #masterauth
- #从服务器只读
- replica-read-only yes
- repl-diskless-sync no
- repl-diskless-sync-delay 5
- repl-disable-tcp-nodelay no
- replica-priority 100
- ##启用增量
- #appendonly yes
- #增量日志文件名,默认值为appendonly.aof
- appendfilename "appendonly-6379.aof"
- #设置对 appendonly.aof 文件进行同步的频率
- #always 表示每次有写操作都进行同步,everysec 表示对写操作进行累积,每秒同步一次。
- #no表示等操作系统进行数据缓存同步到磁盘,都进行同步,everysec 表示对写操作进行累#积,每秒同步一次
- appendfsync no
- no-appendfsync-on-rewrite no
- auto-aof-rewrite-percentage 100
- auto-aof-rewrite-min-size 64mb
- aof-load-truncated yes
- lua-time-limit 5000
- slowlog-log-slower-than 10000
- slowlog-max-len 128
- latency-monitor-threshold 0
- notify-keyspace-events ""
- hash-max-ziplist-entries 512
- hash-max-ziplist-value 64
- list-max-ziplist-entries 512
- list-max-ziplist-value 64
- set-max-intset-entries 512
- zset-max-ziplist-entries 128
- zset-max-ziplist-value 64
- hll-sparse-max-bytes 3000
- activerehashing yes
- client-output-buffer-limit normal 0 0 0
- client-output-buffer-limit replica 256mb 64mb 60
- client-output-buffer-limit pubsub 32mb 8mb 60
- hz 10
- aof-rewrite-incremental-fsync yes
- protected-mode no
- requirepass redis
redis-deployment.yaml
- apiVersion: apps/v1
- kind: Deployment
- metadata:
- labels:
- workload.user.cattle.io/workloadselector: apps.deployment-prod-comredis
- name: comredis
- namespace: prod
- spec:
- replicas: 1
- selector:
- matchLabels:
- workload.user.cattle.io/workloadselector: apps.deployment-prod-comredis
- template:
- metadata:
- labels:
- app: redis
- workload.user.cattle.io/workloadselector: apps.deployment-prod-comredis
- name: comredis
- namespace: prod
- spec:
- containers:
- - args:
- - /usr/local/etc/redis/redis.conf
- command:
- - redis-server
- env:
- - name: TZ
- value: Asia/Shanghai
- image: docker.io/library/redis:6.0
- imagePullPolicy: IfNotPresent
- name: redis
- ports:
- - containerPort: 6379
- name: 6379tcp
- protocol: TCP
- resources:
- limits:
- cpu: '8'
- memory: 16000Mi
- requests:
- cpu: '2'
- memory: 4000Mi
- volumeMounts:
- - mountPath: /usr/local/etc/redis
- name: vol-xzy8e
- dnsPolicy: ClusterFirst
- nodeName: xm-phy-kvm-113-2
- volumes:
- - configMap:
- defaultMode: 420
- name: jumpredis6379.conf
- name: vol-xzy8e
redis-service.yaml
- apiVersion: v1
- kind: Service
- metadata:
- name: redis
- namespace: prod
- spec:
- ports:
- - port: 6379
- protocol: TCP
- targetPort: 6379
- selector:
- app: redis
- sessionAffinity: None
- type: ClusterIP
执行如下命令
- kubectl apply -f redis-configmap.yaml
- kubectl apply -f redis-deployment.yaml
- kubectl apply -f redis-service.yaml
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。