K8S 上搭建 Redis
根据需求搭建一个不需要数据持久化,需要密码登录的 Redis
mkdir /iba/qa_ibaboss_elk -p
cd /iba/qa_ibaboss_elk
# 创建一个专用的 namespace
cat namespace.yaml
---
apiVersion: v1
kind: Namespace
metadata:
name: qa-ibaboss-elk
kubectl apply -f namespace.yaml
# 查看 namespace
kubectl get namespace
创建一个 configmap
mkdir config && cd config
cat redis.conf
#daemonize yes
pidfile /data/redis.pid
port 6379
tcp-backlog 30000
timeout 0
tcp-keepalive 10
loglevel notice
logfile /data/redis.log
databases 16
#save 900 1
#save 300 10
#save 60 10000
stop-writes-on-bgsave-error no
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /data
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
requirepass ibalife
maxclients 30000
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
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 KEA
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 1000
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 slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
# 在 qa-ibaboss-elk namespace 中创建 configmap
kubectl create configmap qa-ibaboss-elk-redis-conf --from-file=redis.conf -n qa-ibaboss-elk
创建 redis 容器
cat qa_ibaboss_elk_redis.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: qa-ibaboss-elk-redis
namespace: qa-ibaboss-elk
spec:
replicas: 1
template:
metadata:
labels:
name: qa-ibaboss-elk-redis
spec:
containers:
- name: qa-ibaboss-elk-redis
image: redis
volumeMounts:
- name: foo
mountPath: "/usr/local/etc"
command:
- "redis-server"
args:
- "/usr/local/etc/redis/redis.conf"
volumes:
- name: foo
configMap:
name: qa-ibaboss-elk-redis-conf
items:
- key: redis.conf
path: redis/redis.conf
# 创建和查看 pod
kubectl apply -f qa_ibaboss_elk_redis.yaml
kubectl get pods -n qa-ibaboss-elk
# 注意:configMap 会挂在 /usr/local/etc/redis/redis.conf 上。与 mountPath 和 configMap 下的 path 一同指定
可以创建一个 busybox 容器进去测试
kubectl run busybox --image=busybox -n qa-ibaboss-elk --command -- ping baidu.com
K8S 上搭建 Redis的更多相关文章
- 在windows上搭建redis集群
一 所需软件 Redis.Ruby语言运行环境.Redis的Ruby驱动redis-xxxx.gem.创建Redis集群的工具redis-trib.rb 二 安装配置redis redis下载地址 ...
- Centos7上搭建redis主从
1. 节点(服务器)数量说明 按照redis官方建议:salve和master的数量按照2n+1台服务器(1台master节点,2n台slave节点) 有兴趣的可以了解下redis的master选举机 ...
- linux上搭建redis
环境centos7及redis-4.0.2.tar.gz 第一步首先在/usr/local/mypackage下mkdir redis 通过工具上传redis安装包 解压安装包 tar -zxvf r ...
- windows系统上搭建redis集群哨兵及主从复制
搭建master 修改redis配置redis.windows.conf: 修改监听端口: port 26379 修改绑定IP: bind 127.0.0.1 添加redis日志:logfile & ...
- 在windows上搭建redis集群(redis-cluster)
一 所需软件:Redis.Ruby语言运行环境.Redis的Ruby驱动redis-xxxx.gem.创建Redis集群的工具redis-trib.rb 二 安装配置redis redis下载地址 ...
- 在windows上搭建redis集群(redis-cluster)(转载)
一 所需软件:Redis.Ruby语言运行环境.Redis的Ruby驱动redis-xxxx.gem.创建Redis集群的工具redis-trib.rb 二 安装配置redis redis下载地址 ...
- k8s 上部署 Redis 三主三从 集群
目录 介绍 为什么要使用Redis? 什么是Redis群集? 在Kubernetes中部署Redis集群 从 GitHub 上下载: 创建pv 创建statefulset 创建service 初始化 ...
- Redis实战(五)CentOS 7上搭建Redis集群
高可用Redis(十二):Redis Cluster https://www.cnblogs.com/renpingsheng/p/9862485.html https://www.cnblogs.c ...
- kubernetes实战(五):k8s持久化安装Redis Sentinel
1.PV创建 在nfs或者其他类型后端存储创建pv,首先创建共享目录 [root@nfs ~]# cat /etc/exports /k8s/redis-sentinel/ *(rw,sync,no_ ...
随机推荐
- django之三剑客、静态文件配置、请求响应对象、数据库操作
三剑客 from django.shortcuts import render,HttpResponse,redirect HttpResponse # 返回字符串 render(response, ...
- 实验1 C语言开发环境和数据类型、运算符、表达式
#include <stdio.h> int main () { int x; printf("输入一个整数:\n"); scanf("%d",&a ...
- POJ2718Smallest Difference(暴力全排列)
传送门 题目大意:升序输入十进制数 没有重复 分成两个非空集合 每个集合组成一个数(不能有前导零) 求两个数差的最小值. 题解:全排列...我数组从1开始怎么一直WA...还有这个输入值得学习. 代码 ...
- [LeetCode] 16. 3Sum Closest 最近三数之和
Given an array nums of n integers and an integer target, find three integers in nums such that the s ...
- Python __name__的使用
__name__是什么 * __开头代表是系统变量; * __name__ 是标识模块名字的系统变量. 当前模块是主模块时, 模块名就是"__main__"; 当模块是被调用(im ...
- LeetCode 220. Contains Duplicate III (分桶法)
Given an array of integers, find out whether there are two distinct indices i and j in the array suc ...
- springmvc单例
默认情况下springmvc都是单例的,用@Controller注解的web页面,下次请求时,可以拿到controller成员变量的上次运行的信息. 比如:controller类里面有: Linked ...
- SqlServer 通过日志恢复数据库
前期工作 查看数据属性,确保下条件: 1.数据库属性->选项->恢复模式=完整 2.建好库以后.一个数据库完整的数据备份 3.到出事期间日志没有你间断 4.记录出事的准确时间 一.数据准备 ...
- [转帖]ZEROCONF是什么
ZEROCONF是什么 xjsunjie关注0人评论9867人阅读2014-05-13 16:12:18 https://blog.51cto.com/xjsunjie/1410592 奇怪 两个文档 ...
- Dart:3.Dart运算符、流程控制
一 . 运算符 以下列出 Dart 的运算符,从高到低按照优先级排列: 描述 运算符 一元运算符(后置) expr++ expr-- () [] . ?. 一元运算符(前置) -expr !expr ...