compose配置文件

services:
  redis7:
    image: redis:7.4.7
    container_name: redis7
    ports:
      - 15818:6379
    networks:
      redis:
    volumes:
      - /data/redis/data:/data
      - /data/redis/conf/redis.conf:/etc/redis.conf
      - /etc/localtime:/etc/localtime
    command: /usr/local/bin/redis-server /etc/redis.conf
    restart: always
    sysctls:
      - net.core.somaxconn=50000
    ulimits:
      nproc: 50000
      nofile:
        soft: 5000000
        hard: 5000000

networks:
  redis:
    name: redis

redis配置文件

bind 0.0.0.0
protected-mode yes              
port 6379                       
tcp-backlog 1024                
timeout 0                       
logfile "/data/redis.log" 
requirepass 'SXDOi-%HcEBJZ89'
rename-command CONFIG REDIS-CONFIG
rename-command FLUSHDB REDIS-FLUSHDB
rename-command FLUSHALL REDIS-FLUSHALL
save 900 1
save 300 10
save 120 300000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
slowlog-log-slower-than 10000
slowlog-max-len 1024
maxmemory 28gb
maxmemory-policy volatile-lru
maxmemory-samples 5
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes
replica-lazy-flush yes
maxclients 6000000
io-threads 8
io-threads-do-reads yes
repl-backlog-size 1gb
repl-diskless-sync yes
activerehashing yes
hz 10
tcp-keepalive 300