PostgreSQL 15 업데이트

So somewhere you changed the postgres port to 50432 instead of 5432? (OR maybe the migration code does that and I’ve never noticed).

Maybe switch to the postgres13 template as suggested in the OP? And if that works, what I would do is move to a new server and avoid the whole transition-to-new-postgres-version issue and just restore the database to the new server.

2개의 좋아요

I didn’t change it, and that socket does exist so… :person_shrugging:

I did that for now, but I assume that’s a bad idea long-term

I’ll let the one who manages the server know ig

2개의 좋아요

So maybe it does run two postgres to make the move.

True, but I’m relieved that your back up!

1개의 좋아요

I don’t have enough space to perform this upgrade on my Discourse partition. However, I have plenty of space on another drive. Is there a way to use this for the temporary storage?

1개의 좋아요

It’s probably time for an OS upgrade anyway, and moving to a fresh VM is much easier, requires little downtime, and if something goes wrong, you still have a working server.

If you’ve got a separate data container, you can try moving all of /var/discourse/shared/data to the other partition and adjusting the volumes in your YML accordingly.

And if you don’t have a separate container, you can do something like that, it’s just more complicated.

2개의 좋아요

저도 비슷한 (동일한?) 문제를 겪고 있습니다. 말씀하신 로그를 확인해 보셨나요?

제 경우: 업데이트를 진행하던 중 앱(제 경우 웹 전용) 컨테이너가 재빌드되지 않는 문제가 발생했습니다. rss-polling을 커스텀 플러그인으로 추가해 두었는데, 이것이 새로운 기본 설정과 충돌하는 것 같았습니다. 해당 플러그인을 제거한 후에는 정상적으로 작동했습니다.

하지만 그 후 vector 확장 프로그램이 없다는 오류가 발생했습니다. 이는 데이터 컨테이너를 오랫동안 재빌드하지 않았기 때문이었습니다. 이제 13버전으로 재빌드하는 데 성공했지만, 현재 13버전이 실행 중인 상태에서 data.yaml을 postgres.template 또는 postgres.15.template으로 변경하면 마이그레이션이 실패합니다.

처음에는 “unclean shutdown” 오류가 발생했는데, 위의 힌트를 참고하여 해결했습니다. 하지만 지금은 마이그레이션이 실패하는데, 13버전 설치 파일이 없는 것 같습니다. /shared 디렉터리에 남은 잔여 파일 때문일까요? (이미 postgres_new 디렉토리를 정리해 보았습니다.)


-----------------------------------------------------------------
  pg_upgrade run on Fri Oct 17 09:54:37 2025
-----------------------------------------------------------------

command: "/usr/lib/postgresql/13/bin/pg_ctl" -w -l "/shared/postgres_data_new/pg_upgrade_output.d/20251017T095437.518/log/pg_upgrade_server.log" -D "/shared/postgres_data" -o "-p 50432 -b  -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/lib/postgresql'" start >> "/shared/postgres_data_new/pg_upgrade_output.d/20251017T095437.518/log/pg_upgrade_server.log" 2>&1
waiting for server to start....2025-10-17 09:54:37.744 UTC [1900] LOG:  starting PostgreSQL 13.22 (Debian 13.22-1.pgdg12+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14+deb12u1) 12.2.0, 64-bit
2025-10-17 09:54:37.749 UTC [1900] LOG:  listening on Unix socket "/var/lib/postgresql/.s.PGSQL.50432"
2025-10-17 09:54:37.760 UTC [1900] LOG:  could not open configuration file "/etc/postgresql/13/main/pg_hba.conf": No such file or directory
2025-10-17 09:54:37.760 UTC [1900] FATAL:  could not load pg_hba.conf
2025-10-17 09:54:37.762 UTC [1900] LOG:  database system is shut down
 stopped waiting
pg_ctl: could not start server
Examine the log output.
```

저라면 아마도 기존 컨테이너로 PG13로 돌아가는 것(그걸 어떻게 찾아내는지 알아내야 하지만)을 먼저 시도하고, 백업을 만든 뒤 새 서버로 옮길 것 같습니다(어차피 새 OS가 필요할 가능성이 높으니까요).

현재 가지고 계신 컨테이너는 어떤 깨진 상태에 있는 것 같습니다. PG13 템플릿으로 재구축을 시도하고 있는 건가요? 정상 작동으로 돌아가려면 postgres 백업 폴더를 postgres_data로 이동하고 버전을 13으로 되돌려야 할 수 있습니다.

네, 현재 PG13 컨테이너를 사용 중입니다. 여러 번 재빌드해 보았으며, 떠 있는 _new 디렉터리까지 정리했습니다. 그런데 15 버전이나 공식 버전 미지정 템플릿으로 전환을 시도할 때마다 실패합니다. 이 문제가 스스로 해결되지 않는다면 곧 수동으로 마이그레이션할 예정입니다. 여기서 OS가 왜 관련이 있는지 모르겠습니다.

참고로 postgres.15.template과 postgres.template의 스크립트 순서가 다른데, 업데이트를 위해 어느 쪽이 더 나은가요?

용량(Mount) 구조를 재구성하여 Shared 또는 shared/postgres 디렉터리 전체가 동일한 볼륨에 위치하도록 하세요. 그러면 정기적으로 필요한 디렉터리 이름 변경이 더 이상 문제가 되지 않을 것입니다.

즉각적인 문제와 직접적인 관련이 없을 수 있습니다. Postgres 업그레이드가 필요할 정도로 Discourse를 오래 운영해 왔다면, OS 업그레이드도 시기가 된 경우가 대부분입니다.

새 서버로 이전하면 거의 무중단으로 진행할 수 있으며, 시스템이 깨진 상태로 남을 위험도 없습니다.

반면, 제가 스크립트로 수행한 대부분의 업그레이드(여기에 설명된 내용만 수행하는 스크립트)는 문제없이 진행되었습니다.

버전이 붙지 않은 파일(unversioned one)로 전환한 후, 두 번의 리빌드(rebuild)를 수행하는 것이 좋을 것 같습니다.

네, 시도해 봤는데 이것도 작동하지 않습니다. 둘 다 실패하네요. 그래서 수동으로 처리하겠습니다.

8개의 게시글이 새로운 주제로 분리되었습니다: Trouble with postgres 15 upgrade