linux
docker-compose.yml
services:
redis:
container_name: redis
image: redis:7.4.1-alpine
restart: always
ports:
- "16379:6379"
volumes:
- ./conf/redis.conf:/etc/redis/redis.conf:rw
- ./data:/data:rw
command: "redis-server /etc/redis/redis.conf"
redis.conf [execute permission]
bind 0.0.0.0
protected-mode no
port 6379
timeout 60
save 900 1
save 300 10
save 60 10000
rdbcompression yes
dbfilename dump.rdb
dir /data
appendonly yes
appendfsync everysec
requirepass 123456
rename-command FLUSHALL ""
rename-command FLUSHDB ""
rename-command CONFIG ""
rename-command KEYS ""
rename-command SHUTDOWN ""
rename-command EVAL ""
windows
redis.windows-service.conf
- install
# windows service
.\redis-server.exe --service-install .\redis.windows-service.conf --loglevel verbose --service-name redis3.0
net start redis3.0
# connect
.\redis-cli.exe -h 127.0.0.1 -p 6379 -a 123456