当前位置:网站首页>docker 安装redis
docker 安装redis
2022-07-23 13:18:00 【Meta39】
查看镜像
docker search redis
下载镜像
查看镜像也可以去docker hub 查找
《官方查询镜像及版本号》
docker pull 镜像名称:版本号
docker pull redis:6.2.6
启动redis并使用宿主机的配置文件
宿主机创建文件夹存放redis.conf
创建/docker_data/redis/data文件夹用于存放redis的数据
mkdir /docker_data/redis/data/
创建redis.conf配置文件,这个文件可以去redis官网找一个拷贝粘贴即可。
vim /docker_data/redis/redis.conf
注释掉bind 127.0.0.1
protected-mode no
daemonize yes
启动redis并使用宿主机配置文件和宿主机的文件夹存放数据
docker run -p 6379:6379 --name redis6.2.6 --privileged=true -v /docker_data/redis/redis.conf:/etc/redis/redis.conf -v /docker_data/redis/data:/data -d redis:6.2.6 redis-server /etc/redis/redis.conf
开放防火墙6379端口,运行外网访问
firewall-cmd --zone=public --add-port=6379/tcp --permanent
必须重启防火墙
firewall-cmd --reload
进入到redis的cli证明redis启动成功
docker exec -it redis6.2.6 /bin/bash
重启redis证明使用的是宿主机的配置文件
修改宿主机redis.conf配置文件的database 16为10
docker restart redis6.2.6
进入redis
docker exec -it redis6.2.6 /bin/bash
redis-cli
我设置了15个库,超过15个就报错,redis的库是从0开始的因此15个是0-14
127.0.0.1:6379> select 15
(error) ERR DB index is out of range
127.0.0.1:6379> select 14
OK
边栏推荐
- Surface family purchase reference
- 通用分页功能
- Cloudcompare & PCL normal vector space sampling (NSS)
- 层次分析法(MATLAB)
- js如果小数是0就减去,不是就保留
- 小米集团副总裁崔宝秋:开源是人类技术进步的最佳平台和模式
- 距离IoU损失:包围盒回归更快更好的学习(Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression)
- FreeRTOS个人笔记-挂起/解挂任务
- pytest接口自动化测试框架 | 如何获取帮助
- COPU副主席刘澎:中国开源在局部领域已接近或达到世界先进水平
猜你喜欢

拼多多APP商品详情接口获取activity_id值(拼多多activity_id接口)

Practice code - day one

深度学习卷积神经网络论文研读-AlexNet

(已解决)idea编译Gradle项目提示 错误找不到符号

FIO performance testing tool
![[2022 freshmen learning] key points of the second week](/img/5f/87a30e898b4450af5f2eb0cf77e035.png)
[2022 freshmen learning] key points of the second week

Using "soup.h1.text" crawler to extract the title will be one more\

fastadmin,非超级管理员,已赋予批量更新权限,仍显示无权限

熵权法优化TOPSIS(MATLAB)

Introduction to Huawei's new version of datacom certification
随机推荐
【C语言】结构体、枚举和联合体
Introduction to Huawei's new version of datacom certification
同花顺上选择券商,网上客户经理开户安全吗
anchor free yolov1
Scale Match for Tiny Person Detection
(resolved) idea compilation gradle project prompt error no symbol found
Distance IOU loss: faster and better learning for bounding box regression
[note] linear regression
动态规划背包问题之多重背包详解
YOLOV7
NodeJs实现token登录注册(KOA2)
小米集团副总裁崔宝秋:开源是人类技术进步的最佳平台和模式
距离IoU损失:包围盒回归更快更好的学习(Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression)
How does MySQL query data that is not in the database?
国内生产总值(GDP)数据可视化
拼多多APP商品详情接口获取activity_id值(拼多多activity_id接口)
Microcomputer principle and technical interface practice in class
距7月30日PMP考试不足10天,应该做点什么?
Liupeng, vice president of copu: China's open source has approached or reached the world's advanced level in some areas
学习笔记7--交通环境行为预测