之前已经写过Redis分别在Linux、Windows上安装部署,及其集群环境搭建。
【Redis实战】Redis安装在Linux系统
【Redis实战】Redis安装在Windows系统
【Redis实战】集群环境搭建
这次写一篇Docker容器部署Redis的教程,配置文件方式启动服务。
docker pull redis
mkdir /docker-data/redis
wget http://download.redis.io/redis-stable/redis.conf
chmod 777 redis.conf
vi /docker-data/redis/redis.conf
bind 127.0.0.1 # 这行要注释掉,解除本地连接限制
protected-mode no # 默认yes,如果设置为yes,则只允许在本机的回环连接,其他机器无法连接。
daemonize no # 默认no 为不守护进程模式,docker部署不需要改为yes,docker run -d本身就是后台启动,不然会冲突
requirepass 123456 # 设置密码
appendonly yes # 持久化
docker run --name redis \
-p 6379:6379 \
-v /docker-data/redis/redis.conf:/etc/redis/redis.conf \
-v /docker-data/redis:/data \
-d redis redis-server /etc/redis/redis.conf --appendonly yes
说明:
docker ps
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://yunfan.blog.csdn.net/article/details/124227286
内容来源于网络,如有侵权,请联系作者删除!