更新 部署Redis.md

This commit is contained in:
8ga
2026-02-27 11:04:54 +08:00
parent 37a2463da8
commit cc1501e8e0
2 changed files with 50 additions and 20 deletions

View File

@@ -1,20 +0,0 @@
```
docker run -d \
--name redis-6.2.6 \
--memory="512m" \
--memory-swap="-1" \
--restart=on-failure:3 \
-p 宿主机端口号:6379 \
-v 替换成redis持久化存储目录:/data \
-e REDIS_PORT=6379 \
-e REDIS_REQUIREPASS='登录密码' \
docker.1ms.run/redis:6.2.6 \
redis-server --bind 0.0.0.0 \
--requirepass 'Ketao@789!' \
--appendonly no \
--save "" \
--dir /data \
--daemonize no \
--maxmemory 500mb \
--maxmemory-policy allkeys-lru
```

50
部署Redis.md Normal file
View File

@@ -0,0 +1,50 @@
## 目录结构
- docker-compose.yaml
- redis.conf
- data/
```yaml
version: '3.8'
services:
redis:
image: redis:8.6 # 替换
container_name: redis
ports:
- "52358:6379" # 替换
volumes:
- ./redis.conf:/usr/local/etc/redis/redis.conf
- ./data:/data
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
restart: on-failure:3
```
## redis.conf
```text
bind 0.0.0.0
port 6379
requirepass 1965589280@Jkw!
protected-mode no
dir /data
save 900 1
save 300 10
save 60 10000
dbfilename dump.rdb
rdbcompression yes
rdbchecksum yes
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
timeout 0
tcp-keepalive 300
loglevel notice
databases 16
daemonize no
supervised no
always-show-logo no
```