In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces Docker how to install and configure Redis image. The article is very detailed and has certain reference value. Interested friends must read it!
preface
How to install Redis image, create Redis container and map port mount data volumes and configuration data.
environment
CentOS 7
Docker 20.10.10
installation
pull images from the nearest region
docker pull redis
view the image
docker images
Create and start MySQL container
Create data directories and profiles
Create Configuration Folder
mkdir -p /mydata/redis/conf
create a profile
The requested URL/conf/redis/was not found on this server.
Create the redis.conf configuration file in advance, because when you mount the local/mydata/redis/conf/redis.conf to/etc/redis/redis.conf, the last redis.conf in the path will not be regarded as a file, but as a directory. Therefore, if we want to mount the local configuration file redis.conf to Docker container, we need to create the configuration file in advance.
#######################################
Complete the steps above to create a data directory and configuration file ~
#######################################
Create and start MySQL container command sudo docker run -p 6379:6379 --name redis \-v /mydata/redis/data:/data \-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf \-d redis redis-server /etc/redis/redis.conf
-p 3306:3306: Map port 6379 of container to port 6379 of host
--name redis: defines the container name as redis
-v /mydata/redis/data:/data: Mount the Redis data folder to the host
-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf: Mount the Redis configuration folder to the host
-d redis redis-server /etc/redis/redis.conf: Run in the background, start with redis image according to the configuration file/etc/redis/redis.conf later
View running containers docker ps
Redisdocker exec -it redis redis-cli connected to Docker
stored-value
set name zhangsan
value
get name
Set up Redis persistent storage
The default redis data is stored in memory. After restarting, the data is lost. After setting persistent storage, the data will still be stored after restarting.
echo "appendonly yes" >> /mydata/redis/conf/redis.conf The above is "Docker how to install and configure Redis image" All the contents of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.