Docker deployment and configuration information Redis

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 dataunder, modify according to their own habits

  • conf: store configuration files
  • data: persistent file (data backup) directory
mkdir -p /data/redis/{conf,data}

New redis.conffile

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, redisthe default port6379
  • -v: mount directory
  • redis-server /redis.conf: by redis-servercommand, 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

Here Insert Picture Description
Said before facie persistent store files in a folder, you can see AOFbackup files
Here Insert Picture Description

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

Published 110 original articles · won praise 423 · views 130 000 +

Guess you like

Origin blog.csdn.net/qq_37143673/article/details/105247324