基于docker 部署redis

1、拉取镜像

复制代码
docker pull redis:latest

如果拉取失败可以尝试下配置镜像源,具体参考如下,目前暂可以使用

Docker切换镜像源-CSDN博客

2、创建配置文件

mkdir /usr/local/redis/conf

vim redis.conf

复制代码
bind 0.0.0.0

#protected-mode no
port 6379
tcp-backlog 511
# 登录密码
requirepass 123456
timeout 0
tcp-keepalive 300
daemonize no
pidfile /var/run/redis_6379.pid
loglevel notice
# 默认没有日志
logfile ""
# 指定日志输出位置
# logfile /var/log/redis/redis-server.log
databases 30
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
appendonly yes
appendfilename "appendonly.aof"
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-max-len 128
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-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
hz 10
aof-rewrite-incremental-fsync yes

3、执行镜像

复制代码
docker run  -p 6379:6379 --name redis --restart=always \
     -v /usr/local/redis/conf/redis.conf:/etc/redis/redis.conf \
     -v /usr/local/redis/data:/data \
     -d redis redis-server /etc/redis/redis.conf \
     --appendonly yes --requirepass 123456
相关推荐
devilnumber6 小时前
Java 递归算法 详解 + 核心要点 + 实战运用 + 避坑指南
java·开发语言·算法
杨浦老苏7 小时前
家庭实验室监控仪表盘HomeLab-Monitor
运维·docker·监控·群晖
asdfg12589638 小时前
JavaBean是什么?怎么理解?有什么用途?
java·开发语言
摇滚侠9 小时前
SpringMVC 入门到实战 文件上传 75-77
java·后端·spring·maven·intellij-idea
GIS数据转换器9 小时前
城市排水生命线安全运行监测平台深度解析
java·运维·人工智能·python·安全·数据挖掘·无人机
华如锦10 小时前
面了很多 Java转AI Agent方向,一些面试题总结
java·开发语言·人工智能·python·ai
睡不醒男孩03082310 小时前
CLup 6.x 版本中针对StarRocks 存算一体集群的完整操作手册
java·服务器·网络·clup
开发者联盟league11 小时前
使用k8s安装Sonarqube
云原生·容器·kubernetes
程序员黑豆11 小时前
Java中怎么实现字符串拼接呢【AI全栈开发】
java