RelaxingChat|Redis部署

2024/12/10 RelaxingChat数据库Docker

# Redis部署

# 创建挂载目录

mkdir -p /data/redis
1

# 创建docker-compose.yml

vim /data/redis/docker-compose.yml
1

填入配置

version: '3'
services:
  redis:
    image: redis:6.2.6
    container_name: redis
    restart: always
    ports:
      - 6379:6379
    volumes:
      - /data/redis/redis.conf:/etc/redis/redis.conf
      - /data/redis/data:/data
      - /data/redis/logs:/logs
    command: ["redis-server","/etc/redis/redis.conf"]
1
2
3
4
5
6
7
8
9
10
11
12
13

# 创建挂载的配置文件

vim /data/redis/redis.conf
1

填入配置

protected-mode no
port 6379
timeout 0
#r db配置
save 900 1
save 300 10
save 60 10000
rdbcompression yes
dbfilename dump.rdb
dir /data
appendonly yes
appendfsync everysec
# 设置你的redis密码
requirepass 123456
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# 启动redis容器

开放6379端口

cd /data/redis
docker-compose up -d
# 如果需要强制重新构建
docker-compose up --force-recreate -d
1
2
3
4
Last Updated: 2024/12/10 23:04:54