1. 準(zhǔn)備redis.conf文件
設(shè)置密碼
requirepass 1Ng4oLeCVoc2ceOG
設(shè)置db數(shù)量读恃,默認(rèn)是16個(gè)
databases 64
設(shè)置日志位置
logfile "/var/log/redis/redis.log"
設(shè)置數(shù)據(jù)存放位置
dir /data
2. docker-compse
version: '3'
services:
redis:
image: redis:6.2.6-alpine
ports:
- "6379:6379"
volumes:
- ./work/components/redis/log/redis.log:/var/log/redis/redis.log:rw
- ./work/components/redis/config/redis.conf:/home/redis/redis.conf:rw
- ./work/components/redis/data:/data:rw
restart: always
privileged: true
command:
/bin/sh -c "redis-server /home/redis/redis.conf"
運(yùn)行docker-compose up -d