江明涛的博客
docker 安装redis
docker 安装redis

docker 安装redis

1.创建目录存放redis.conf文件

mkdir /data/redis/
cd /data/redis/

2.下载redis.conf文件 并授权

wget http://download.redis.io/redis-stable/redis.conf
chmod 777 redis.conf

3.修改默认配置信息

bind 127.0.0.1 通过#注释掉,解除本地连接限制
protected-mode yes 默认no,保护模式,限制为本地访问,修改后解除保护模式
daemonize yes 默认no 为不守护进程模式,修改为yes
requirepass 123456.@123wA  设置密码
appendonly yes 持久化

启动

docker run --restart always -p 16679:6379 --name=redis -v /data/redis/redis.conf:/usr/local/etc/redis/redis.conf -v /data/redis/data:/data  -d redis redis-server /usr/local/etc/redis/redis.conf --appendonly yes

上次更新时间 13 3 月, 2023 at 09:59 上午