Configuration File
# Redis 7.2.3 Configuration File# Bind IP address and allow other IP access# By default, Redis is only bound to 127.0.0.1 local loopback address# If you need to access other IPs, comment out or modify the bound IP address# For example, to allow all IP access, you can comment out the bind line:# bind 127.0.0.1 # Alternatively, specify the IP address that is allowed to access (recommended to use a specific IP):bind 0.0.0.0 # Protect Mode# When bind is 0.0.0.0, it is recommended to turn off protection modeprotected-mode no # Set password and enable authentication# Replace with your own passwordrequirepass 8Mlgasg6WjmNlV7 # Redis default port, default is 6379port 6389 # Maximum number of client connections# The default value is 10000, which can be adjusted according to the requirements.maxclients 10000 # Memory usage limit, setting to 0 means no memory usage is restricted# If the server memory is limited, you can set the maximum memory usage# maxmemory <bytes> # Processing strategy when memory limit is reached# Optional values: volatile-lru, allkeys-lru, volatile-lfu, allkeys-lfu, volatile-random, allkeys-random, volatile-ttl, noeviction# maxmemory-policy noeviction # Persistence configuration: RDB snapshot# Every 60 seconds, if at least 1000 keys are modified, a RDB snapshot is generatedsave 60 1000 # AOF configuration, append file persistenceappendonly no # appendfilename "" # Log level, optional options are: debug, verbose, notice, warningloglevel notice # Log file pathlogfile "" # Database file storage pathdir ./ # The number of databases, default is 16databases 16 # Redis background rundaemonize no # Whether to enable slow query logs# slowlog-log-slower-than 10000 # The maximum number of saved numbers for slow query logs# slowlog-max-len 128
Pull the container and start
docker pull redis:7.2.3 mkdir /opt/soft/redis/conf mkdir /opt/soft/redis/data docker stop redis docker rm redis docker restart redis docker run --name redis -p 6389:6379 -v /opt/soft/redis/conf/:/usr/local/etc/redis/ -v /opt/soft/redis/data:/data --restart=always --privileged=true -d redis:7.2.3 redis-server /usr/local/etc/redis/ docker logs -f redis docker logs 01385ca8ad41 docker logs redis docker logs redis
Other questions
docker starts Redis6.0 and keeps restarting, no other ports occupied, no actual error log
reason:
The "daemonize yes" in the configuration file and the --restart=always daemon run in the docker startup command. The two conflicts
# Modify the Redis background operation in the configuration file, and modify it to nodaemonize no
This is the end of this article about the deployment method of Docker Redis 7.2.3. For more related Docker Redis deployment content, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!