Skip to content

Commit e723c40

Browse files
committed
[fix]clean redis before start
1 parent ffe2f6b commit e723c40

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lightllm/utils/redis_utils.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,35 @@ def start_redis_service(args):
99
if not hasattr(args, "start_redis") or not args.start_redis:
1010
return None
1111

12+
config_server_host = args.config_server_host
13+
redis_port = args.redis_port
1214
try:
13-
redis_port = args.redis_port
15+
subprocess.run(
16+
["redis-cli", "-h", config_server_host, "-p", str(redis_port), "FLUSHALL", "ASYNC"], check=False, timeout=2
17+
)
18+
subprocess.run(
19+
["redis-cli", "-h", config_server_host, "-p", str(redis_port), "SHUTDOWN", "NOSAVE"], check=False, timeout=2
20+
)
21+
except Exception:
22+
pass
1423

24+
try:
1525
redis_command = [
1626
"redis-server",
1727
"--port",
1828
str(redis_port),
1929
"--bind",
20-
f"{args.config_server_host}",
30+
f"{config_server_host}",
2131
"--daemonize",
2232
"no",
2333
"--logfile",
2434
"-",
2535
"--loglevel",
2636
"notice",
37+
"--save",
38+
'""', # 不触发 RDB 快照
39+
"--appendonly",
40+
"no", # 关闭 AOF
2741
]
2842

2943
logger.info(f"Starting Redis service on port {redis_port}")

0 commit comments

Comments
 (0)