Get the App
SLTechnology News&Howtos  ›  Servers  › 

How docker installs redis 5.0.7 and mounts external configuration and data

Shulou Source: shulou.com Published: 2022-06-01 19:32:59 10月03日 Update

Xiaobian to share with you how to install docker redis 5.0.7 and mount external configuration and data, I hope you have something to gain after reading this article, let's discuss it together!

Redis is an open-source, web-enabled, memory-based and persistent log type, Key-Value NoSQL database written in ANSI C, and provides APIs in multiple languages.

environment

CentOS Linux release 7.7.1908 (Core)

Pull redis 5.0.7 mirror

docker pull redis:5.0.7

Create mount directory

mkdir -p /home/app/redis/confmkdir -p /home/app/redis/data

Download redis.conf

redis.conf Address

Go to the directory and download redis.conf

cd /home/app/redis/confwget https://raw.githubusercontent.com/antirez/redis/5.0/redis.conf

Modify redis.conf

Comment symbol # 1. Notes bind 127.0.0.1 2. Protected-mode yes modified to protected-mode no 3. Add requirepass yourpassword Note: Steps 1 and 2 are intended for remote connection to redis. If local access is required, no modification is required.

Creating a Startup Container

docker run --restart=always -d --privileged=true -p 6379:6379 -v /home/app/redis/conf/redis.conf:/etc/redis/redis.conf -v /home/app/redis/data:/data --name redis redis:5.0.7 redis-server /etc/redis/redis.conf --appendonly yes

parameter interpretation

--restart=always -> Start the container, container abnormal automatic restart-d -> Start container as daemon--privileged=true -> Increase permissions in container-p 6379:6379 -> Binding host ports-v /home/app/redis/conf/redis.conf:/etc/redis/redis.conf -> Mapping configuration files-v /home/app/redis/data:/data -> Mapping data directory--name redis -> Specify container name--appendonly yes -> Open data persistence After reading this article, I believe you have a certain understanding of "docker how to install redis 5.0.7 and mount external configuration and data". If you want to know more about it, please pay attention to the industry information channel. Thank you for reading!

Tags: Container data configuration directory step comment article language memory parameter just need name address variety done host host password database file Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL NVidia Shulou Information Shulou Technology macOS