Docker Redis installation and configuration information
Get a mirror
Redis access the image library Address: DockerHub Redis
docker pull redis
New Profile
My habits, things are put data
under, modify according to their own habits
- conf: store configuration files
- data: persistent file (data backup) directory
mkdir -p /data/redis/{conf,data}
New redis.conf
file
Only here temporarily persistence configuration, you need the other can add their own
cat << EOF > /data/redis/conf/redis.cnf
# RDB 持久化,快照保存频率
# 900秒内,如果超过1个key被修改,则发起快照保存
# 300秒内,如果超过10个key被修改,则发起快照保存
# 60秒内,如果1万个key被修改,则发起快照保存
save 900 1
save 300 10
save 60 10000
# 开启 AOF 持久化
appendonly yes
EOF
Boot image
- -d: background container
- -name: container named
- -p: Port mapping,
redis
the default port6379
- -v: mount directory
- redis-server /redis.conf: by
redis-server
command, start to mount our own configuration file, otherwise it will use the default configuration file
docker run -d --name redis -p 6379:6379 -v /data/redis/conf/redis.conf:/redis.conf -v /data/redis/data:/data redis redis-server /redis.conf
Successful start
Said before facie persistent store files in a folder, you can see AOF
backup files
Reference configuration information
How redis rational allocation, these 10 configuration parameters you need to know
Redis Detailed profiles
Redis configuration file description of the parameters and performance tuning
redis profile common configuration in detail