One .docker Installation in redis The last is as follows , I installed it reidis3.2.12 edition
Two . reach redis Download a copy from the official website redis.conf, Put it in the specified directory
1,mkdir /user/local/redis/
2, Put the above configuration file into /user/local/redis/ Under the table of contents
Three . appoint redis.conf start-up
docker run -d --name RedisDocker6380 -p 6380:6379 -v
/usr/redis/redis_6380.conf:/etc/redis/6380/redis.conf -v
/data/redis_data/6380:/data redis:3.2 redis-server /etc/redis/6380/redis.conf
--appendonly yes --bind 0.0.0.0 --protected-mode no
Four Parameter description
be careful : stay docker Start in redis We must :daemonize Set to no, This is very important , If not no
docker It will always fail to start , as a result of docker It needs to run in the background , This configuration option is also started as a daemon , The two conflict
1.-p 6380:6379:
The first port is the host port ( Server port ), The second port is the container port ( Containers are sandboxes that cannot be accessed outside ), Put the container's 6379 Port mapped to host's 6380 Port , This can be done by accessing the host computer 6380 To visit redis;
2.–name RedisDocker6380:
Name of container iredis It is convenient to operate the container in the future (docker start RedisDocker6380 ;docker stop
RedisDocker6380 wait );
3.-v /usr/redis/redis_6380.conf:/etc/redis/6380/redis.conf:
Mount persistent configuration
/usr/redis/redis_6380.conf: It's the host ( The server ) Your own redis.conf File path
/etc/redis/6380/redis.conf:
Inside the container redis.conf File path , No need to create it manually , When the container starts, it will host the redis.conf Automatically map to changed directory .
This is changing redis.conf You don't have to go inside the container to modify the file
4.-v /data/redis_data/6380:/data:
Mounting persistent files
/data/redis_data/6380 Is the location of persistent files in the host ,/data Is the location of the persistent file in the container
5.-d :
Background start
6.redis:3.2 redis-server /etc/redis/redis.conf:
redis:3.2 Is the name of the mirror + The version is as follows
7.redis-server /etc/redis/redis.conf
Specifies to start as a configuration file redis
8. –appendonly yes Open persistence
Five . Enter the container to verify whether it is generated redis.conf and data What about persistent files ?
Six . see redis Start log for
Technology
Daily Recommendation