当前位置:网站首页>Docker安装Redis
Docker安装Redis
2022-07-06 10:31:00 【一个正在努力的菜鸡】
Docker安装Redis
1.下载redis镜像

2.创建本地目录方便数据卷映射
- 创建目录结构如下

- 下载redis.conf并修改配置
1.基本配置
#bind 127.0.0.1 #注释掉,使redis可以被外部访问
requirepass a #给redis设置密码a
logfile/data/redis.log #指定日志文件
protected-mode no #关闭保护模式
2.RDB数据文件基本配置
#设置RDB文件名与文件路径
dbfilename dump.rdb #默认
dir /data #./改成/data
#设置快照间隔,可根据实际请求压力调整
save 3600 1 #3600s内有1条key变化就快照,压力小
save 300 100 #300s内有10条key变化就快照
save 60 10000 #60s内有10000条key变化就快照,压力大
#redis是内存库,但内存就怕关机,所以要及时将数据持久化到磁盘
rdbcompression yes #备份文件压缩
rdbchecksum yes #校验码
stop-writes-on-bgsave-error yes #持久化出错,主程序是否停止写入
3.AOF日志文件基本配置
appendonly yes #AOF追加模式备份
dir /data #备份文件存放位置
aof-use-rdb-preamble yes #混合持久化方式
3.启动redis
- 图中语句有错误,正确命令如下代码中

docker run -itd --name redis -p 6379:6379 --restart=always -v d:\dockercontainers\redis\redis.conf:/etc/redis/redis.conf -v d:\dockercontainers\redis\data:/data redis redis-server /etc/redis/redis.conf
4.进入容器
docker exec -it redis /bin/bash
5.下载redis软件,测试连接


边栏推荐
- win10系统下插入U盘有声音提示却不显示盘符
- Jerry's access to additional information on the dial [article]
- Compilation Principle -- C language implementation of prediction table
- Heavy! Ant open source trusted privacy computing framework "argot", flexible assembly of mainstream technologies, developer friendly layered design
- D binding function
- 重磅硬核 | 一文聊透对象在 JVM 中的内存布局,以及内存对齐和压缩指针的原理及应用
- Will openeuler last long
- 容器里用systemctl运行服务报错:Failed to get D-Bus connection: Operation not permitted(解决方法)
- Dichotomy (integer dichotomy, real dichotomy)
- 2022暑期项目实训(二)
猜你喜欢

Implementation of queue
![Jerry's updated equipment resource document [chapter]](/img/6c/17bd69b34c7b1bae32604977f6bc48.jpg)
Jerry's updated equipment resource document [chapter]

Introduction to the usage of model view delegate principal-agent mechanism in QT

【Swoole系列2.1】先把Swoole跑起来
![[.Net core] solution to error reporting due to too long request length](/img/62/6bdc43885f9be3fa4538276c0dc122.png)
[.Net core] solution to error reporting due to too long request length

趣-关于undefined的问题

從交互模型中蒸餾知識!中科大&美團提出VIRT,兼具雙塔模型的效率和交互模型的性能,在文本匹配上實現性能和效率的平衡!...

2019阿里集群数据集使用总结

The integrated real-time HTAP database stonedb, how to replace MySQL and achieve nearly a hundredfold performance improvement
![[Android] kotlin code writing standardization document](/img/d5/53d6a75e87af15799bf7e5d6eb92a5.png)
[Android] kotlin code writing standardization document
随机推荐
Fleet tutorial 13 basic introduction to listview's most commonly used scroll controls (tutorial includes source code)
重磅硬核 | 一文聊透对象在 JVM 中的内存布局,以及内存对齐和压缩指针的原理及应用
图片缩放中心
[swoole series 2.1] run the swoole first
Transport layer congestion control - slow start and congestion avoidance, fast retransmission, fast recovery
Release of the sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
Comparative examples of C language pointers *p++, * (p++), * ++p, * (++p), (*p) + +, +(*p)
STM32+HC05串口蓝牙设计简易的蓝牙音箱
The integrated real-time HTAP database stonedb, how to replace MySQL and achieve nearly a hundredfold performance improvement
小程序在产业互联网中的作用
win10系统下插入U盘有声音提示却不显示盘符
Coco2017 dataset usage (brief introduction)
Jielizhi obtains the customized background information corresponding to the specified dial [chapter]
node の SQLite
具体说明 Flume介绍、安装和配置
最新财报发布+天猫618双榜第一,耐克蓄力领跑下个50年
SAP Fiori 应用索引大全工具和 SAP Fiori Tools 的使用介绍
2019阿里集群数据集使用总结
当保存参数使用结构体时必备的开发技巧方式
Jerry's watch reads the file through the file name [chapter]