1 redis configuration fileOfficial download: redis.conf Path: In the container, it can generally be saved in the Detailed explanation of the configuration file, modify it according to the actual situation: # The bind here means that only the specified network segment can access redis. If it is commented out, there is no such restriction. # bind 127.0.0.1 # The default port is 6379 port 6379 # daemonize indicates whether to execute as a daemon process. The execution in the container must be set to no # If set to yes in the container, it will conflict with -d in docker run, causing startup failure. daemonize no # protected-mode # Set to yes to enable protection mode, which means remote access is not possible. # Set to no to enable protection mode, which means remote access is possible. protected-mode no # If you comment out, the default redis password is empty. # If you enable it, redis123 will be the redis login password requirepass redis123 # databases Set the number of databases to 16 #save save 900 1 save 300 10 save 60 10000 # aof mode is not enabled by default, and RDB persistence is used by default appendonly yes # Change to yes to enable aof function appendfilename "appendonly.aof" # The name of the persistent file # appendfsync always # Each modification will be synced, which consumes performance appendfsync everysec # Execute sync once a second, and the data of 1s may be lost # appendfsync no # Do not execute sync, the operating system will automatically synchronize data 2 Docker command startStartup Command docker run -p 6379:6379 \ -v /Users/chenbinhao/redis_6379/data:/data \ -v /Users/chenbinhao/redis_6379/config/redis.conf:/etc/redis/redis.conf \ -d redis redis-server /etc/redis/redis.conf --appendonly yes Parameter Description Log view: 3 docker-compose startDirectory Structure ├─reids_6379 │ ├─docker-compose.yml │ ├─config │ │ └─redis.conf │ └─data │ │ └─.. Configure version: '3' services: redis: image: redis:latest restart: always ports: - "6379:6379" volumes: - "./data:/data" - "./config/redis.conf:/etc/redis/redis.conf" command: redis-server /etc/redis/redis.conf Startup Command Start: Execute Stop and delete: This is the end of this article about the steps to deploy redis in docker containers. For more information about deploying redis in docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: MySQL Series Database Design Three Paradigm Tutorial Examples
>>: CSS3 realizes the graphic falling animation effect
Table of contents 1. What is multi-instance 2. Pr...
Using the CSS float property correctly can become...
I was curious about how to access the project usi...
1. Unzip MySQL 8.0.16 The dada folder and my.ini ...
Today's Tasks 1. Choice of Linux distribution...
1. Problem The docker container logs caused the h...
1. Download Dependency npm install @antv/data-set...
What is a stored procedure Simply put, it is a se...
I followed the tutorial on W3school. I think the t...
1. Purchase of Server 1. I chose Alibaba Cloud...
Table of contents 1. JavaScript Objects 1).Array ...
The previous article wrote about how to manually ...
1. Prerequisites 1. The project has been deployed...
Docker takes up a lot of space. Whenever we run c...
I have been learning about responsive design rece...