欢迎光临
我们一直在努力

Docker Compose 复用旧数据卷导致 PostgreSQL 角色认证失败的处理

服务重启后应用日志里数据库连接突然报 password authentication failed,附加信息是 Role \”postgres\” does not exist。代码和配置都没动,问题往往出在容器数据目录被复用、初始化流程被跳过上。

问题现象

一套 FastAPI 加 SQLAlchemy 加 Redis Stream 的服务,outbox 轮询原本正常工作。docker compose down 再 up 之后,应用日志出现:

auth-service | BEGIN (implicit)
auth-service | SELECT outbox_messages.id, outbox_messages.aggregate_type, …
auth-service | FROM outbox_messages
auth-service | WHERE outbox_messages.processed = false
auth-service | LIMIT $1::INTEGER FOR UPDATE SKIP LOCKED
auth-service | COMMIT
auth-postgres | FATAL: password authentication failed for user \”postgres\”
auth-postgres | DETAIL: Role \”postgres\” does not exist.
auth-postgres | Connection matched f

赞(0)
未经允许不得转载:171主机测评 » Docker Compose 复用旧数据卷导致 PostgreSQL 角色认证失败的处理
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址