docker安装部署redis6通用标准
快速部署
部署详解
创建Redis映射文件夹
mkdir -p /data/redis/{config,data}
下载官网提供的配置文件模版:
- The self documented redis.conf for Redis 7.0.
- The self documented redis.conf for Redis 6.2.
- The self documented redis.conf for Redis 6.0.
- The self documented redis.conf for Redis 5.0.
- The self documented redis.conf for Redis 4.0.
- The self documented redis.conf for Redis 3.2.
- The self documented redis.conf for Redis 3.0.
- The self documented redis.conf for Redis 2.8.
- The self documented redis.conf for Redis 2.6.
- The self documented redis.conf for Redis 2.4.
下载并修改一下配置内容,未列出不用更改:(这里已Redis 6.2版本为例)
bind 127.0.0.1 -::1 修改为 bind 0.0.0.0
# requirepass foobared 修改为 requirepass RQ51DxupfM3TEoQGKb (RQ51DxupfM3TEoQGKb为在线生成的随机密码)
appendonly no 修改为:appendonly yes
pidfile /var/run/redis_6379.pid 修改为 pidfile /data/redis_6379.pid
dir ./ 修改为 dir /data/
修改后文件模版:
redis单点启动语句:
docker run --name redis \
--restart=always \
-p 6379:6379 \
-v /data/redis/config/redis.conf:/etc/redis/redis.conf \
-v /data/redis/data:/data \
-d redis:6.2.7 redis-server /etc/redis/redis.conf
创建后文件夹结构如下:
/data/redis
├── config
│ └── redis.conf
└── data
├── appendonly.aof
├── backup.db
├── dump.rdb
├── redis_6379.pid
└── root
文章目录
关闭