当前位置:网站首页>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软件,测试连接


边栏推荐
- Declval of template in generic programming
- IP, subnet mask, gateway, default gateway
- Wchars, coding, standards and portability - wchars, encodings, standards and portability
- 1700C - Helping the Nature
- FMT开源自驾仪 | FMT中间件:一种高实时的分布式日志模块Mlog
- TOP命令详解
- Four processes of program operation
- CRMEB 商城系统如何助力营销?
- epoll()无论涉及wait队列分析
- Interesting - questions about undefined
猜你喜欢

MS-TCT:Inria&SBU提出用于动作检测的多尺度时间Transformer,效果SOTA!已开源!(CVPR2022)...

Transport layer congestion control - slow start and congestion avoidance, fast retransmission, fast recovery

FMT open source self driving instrument | FMT middleware: a high real-time distributed log module Mlog

从交互模型中蒸馏知识!中科大&美团提出VIRT,兼具双塔模型的效率和交互模型的性能,在文本匹配上实现性能和效率的平衡!...

TOP命令详解

IP, subnet mask, gateway, default gateway

Windows connects redis installed on Linux

F200——搭载基于模型设计的国产开源飞控系统无人机

30 minutes to understand PCA principal component analysis

Interesting - questions about undefined
随机推荐
模板于泛型编程之declval
Easy to use PDF to SVG program
30 分钟看懂 PCA 主成分分析
面试突击62:group by 有哪些注意事项?
虚拟机VirtualBox和Vagrant安装
图片缩放中心
Take you through ancient Rome, the meta universe bus is coming # Invisible Cities
复现Thinkphp 2.x 任意代码执行漏洞
Automatic reservation of air tickets in C language
Principle and usage of extern
MSF横向之MSF端口转发+路由表+SOCKS5+proxychains
阿里云国际版ECS云服务器无法登录宝塔面板控制台
bonecp使用数据源
Brief description of SQL optimization problems
QT中Model-View-Delegate委托代理机制用法介绍
D binding function
High precision operation
Implementation of queue
Introduction to the usage of model view delegate principal-agent mechanism in QT
2022 Summer Project Training (III)