Quart_Sessions Redis 删除键并创建备份
我现在正在使用Quart,并配合Quart_Sessions来管理登录等会话。
我遇到一个问题,有时候Redis数据库里的所有数据都被删除了,取而代之的是4个备份("backup1", "backup2", "backup3", "backup4"
)。这导致所有的会话都失效了。
Redis数据库是通过Portainer创建的一个堆栈:
version: '3'
services:
redis:
image: redis
restart: always
ports:
- "6379:6379"
environment:
- REDIS_PASSWORD=[MyPassword]
volumes:
- redis_data:/data
- ./redis.conf:/etc/redis/redis.conf
volumes:
redis_data:
driver: local
与Quart的连接方式如下:
from quart import Quart, jsonify, request, send_from_directory, render_template, redirect, url_for, session, g, make_response
from quart_session import Session
app = Quart(__name__, template_folder='static')
app.secret_key = '[MyPassword]'
redis = None
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
app.config['TEMPLATES_AUTO_RELOAD'] = True
app.config['JWT_SECRET_KEY'] = '[MyPassword]'
app.config['SESSION_TYPE'] = 'redis'
app.config['SESSION_URI'] = 'redis://default:[MyPassword]@[URL]:6379'
app.config['SESSION_USE_SIGNER'] = False
app.config['SESSION_PROTECTION'] = True
app.config['SESSION_COOKIE_DOMAIN'] = ".[DOMAIN]"
app.config['SESSION_COOKIE_NAME'] = 'User session'
app.config['SESSION_COOKIE_MAX_AGE'] = 3600
app.config['SESSION_REVERSE_PROXY'] = True
Session().init_app(app)
有人能告诉我为什么会这样吗?
- 重新安装Redis数据库
- 调整参数
- 更新Quart和所有相关包
0 个回答
暂无回答