중국에서 PostgreSQL 업데이트 실패

데이터를 재빌드할 수 없습니다

./launcher rebuild data
x86_64 아키텍처를 감지했습니다.
런처가 최신 상태인지 확인 중
런처는 최신 상태입니다
2.0.20250129-0720: docker-hub-china/discourse-base에서 가져오는 중
Digest: sha256:d798a945ca4d31c29e5d263cdaf807bafab9b5f6737be0b1b852bea0063a3b91
Status: registry.cn-wulanchabu.aliyuncs.com/docker-hub-china/discourse-base:2.0.20250129-0720 이미지는 최신 상태입니다
registry.cn-wulanchabu.aliyuncs.com/docker-hub-china/discourse-base:2.0.20250129-0720
/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2025-02-06T04:49:43.809493 #1]  INFO -- : stdin에서 읽는 중
I, [2025-02-06T04:49:43.812252 #1]  INFO -- : 없는 before_code 훅을 건너뜀
I, [2025-02-06T04:49:43.812294 #1]  INFO -- : 없는 before_db_migrate 훅을 건너뜀
I, [2025-02-06T04:49:43.812309 #1]  INFO -- : 없는 after_code 훅을 건너뜀
I, [2025-02-06T04:49:43.816721 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown: 
I, [2025-02-06T04:49:43.820580 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown: 
I, [2025-02-06T04:49:43.824283 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown: 
I, [2025-02-06T04:49:43.827979 #1]  INFO -- : File > /root/install_postgres  chmod: +x  chown: 
I, [2025-02-06T04:49:43.832007 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown: 
I, [2025-02-06T04:49:43.832273 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 data_directory = '/var/lib/postgresql/15/main'을 data_directory = '/shared/postgres_data'로 대체하는 중
I, [2025-02-06T04:49:43.832904 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?listen_addresses *=.*)을 listen_addresses = '*'로 대체하는 중
I, [2025-02-06T04:49:43.833313 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?synchronous_commit *=.*)을 synchronous_commit = $db_synchronous_commit으로 대체하는 중
I, [2025-02-06T04:49:43.843122 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?shared_buffers *=.*)을 shared_buffers = $db_shared_buffers으로 대체하는 중
I, [2025-02-06T04:49:43.843548 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?work_mem *=.*)을 work_mem = $db_work_mem으로 대체하는 중
I, [2025-02-06T04:49:43.843885 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?default_text_search_config *=.*)을 default_text_search_config = '$db_default_text_search_config'으로 대체하는 중
I, [2025-02-06T04:49:43.844162 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?checkpoint_segments *=.*)을 checkpoint_segments = $db_checkpoint_segments으로 대체하는 중
I, [2025-02-06T04:49:43.844439 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?logging_collector *=.*)을 logging_collector = $db_logging_collector으로 대체하는 중
I, [2025-02-06T04:49:43.844732 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?log_min_duration_statement *=.*)을 log_min_duration_statement = $db_log_min_duration_statement으로 대체하는 중
I, [2025-02-06T04:49:43.845050 #1]  INFO -- : /etc/postgresql/15/main/pg_hba.conf에서 (?-mix:^#local +replication +postgres +peer$)을 local replication postgres  peer로 대체하는 중
I, [2025-02-06T04:49:43.845283 #1]  INFO -- : /etc/postgresql/15/main/pg_hba.conf에서 (?-mix:^host.*all.*all.*127.*$)을 host all all 0.0.0.0/0 md5로 대체하는 중
I, [2025-02-06T04:49:43.845505 #1]  INFO -- : /etc/postgresql/15/main/pg_hba.conf에서 (?-mix:^host.*all.*all.*::1\/128.*$)을 host all all ::/0 md5로 대체하는 중
I, [2025-02-06T04:49:43.845723 #1]  INFO -- : > if [ -f /root/install_postgres ]; then
  /root/install_postgres && rm -f /root/install_postgres
elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then
  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
fi

2025/02/06 04:49:45 socat[33] E connect(, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): Connection refused
initdb: warning: 로컬 연결에 대한 "trust" 인증을 활성화합니다
initdb: hint: pg_hba.conf를 편집하거나 -A 옵션 또는 --auth-local 및 --auth-host 옵션을 사용하여 다음 initdb 실행 시 이 설정을 변경할 수 있습니다.

로그가 불완전한 것으로 보이지만, 아래 스니펫에서 힌트를 얻을 수 있습니다.

socat[33] E connect(, AF=1 “/shared/postgres_run/.s.PGSQL.5432”, 36): Connection refused

로그 출력 하단에도 아래 오류가 표시되는지 확인해 보세요.

The source cluster was not shut down cleanly

해당 오류가 표시된다면 이 지침을 따라 시도해 볼 수 있습니다.

실행 중인 컨테이너가 없습니다

첫 단계에서 어떤 오류가 표시됩니까?

data.yml와 web_only.yml 메서드를 사용했습니다

같은 지침을 따를 수 있지만, app 또는 standalone이 나타나는 모든 부분을 data로 교체해야 합니다.

아직 연결되지 않았습니다

$ ./launcher enter data
x86_64 아키텍처가 감지되었습니다.
root@sober-data:/# export SVWAIT=300
sv stop nginx
sv stop unicorn
sv stop postgres
exit
fail: nginx: unable to change to service directory: file does not exist
fail: unicorn: unable to change to service directory: file does not exist
ok: down: postgres: 0s, normally up
logout

이는 컨테이너에 연결되어 있었음을 의미합니다. (data 컨테이너를 재빌드하는 동안 web_only 컨테이너가 중지된 상태로 유지되는지 확인하십시오.)

ok: down: postgres: 0s, normally up

이것이 중요한 출력입니다. postgres가 이제 정상적으로 종료되었음을 의미하며 다음 단계로 진행할 수 있습니다.

 ./launcher enter  data
x86_64 아키텍처가 감지되었습니다.
root@sober-data:/# sv stop postgres
ok: down: postgres: 0s, normally up
root@sober-data:/# exit
logout
root@sober:/var/discourse$ ./launcher rebuild  data
x86_64 아키텍처가 감지되었습니다.
런처가 최신 상태인지 확인하는 중
런처는 최신 상태입니다
기존 컨테이너를 중지하는 중
+ /usr/bin/docker stop -t 600 data
data
2.0.20250129-0720: docker-hub-china/discourse-base에서 가져오는 중
Digest: sha256:d798a945ca4d31c29e5d263cdaf807bafab9b5f6737be0b1b852bea0063a3b91
Status: registry.cn-wulanchabu.aliyuncs.com/docker-hub-china/discourse-base:2.0.20250129-0720 이미지가 최신 상태입니다
registry.cn-wulanchabu.aliyuncs.com/docker-hub-china/discourse-base:2.0.20250129-0720
/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2025-02-06T06:19:20.379635 #1]  INFO -- : stdin에서 읽는 중
I, [2025-02-06T06:19:20.380959 #1]  INFO -- : 누락된 before_code 훅을 건너뜀
I, [2025-02-06T06:19:20.380976 #1]  INFO -- : 누락된 before_db_migrate 훅을 건너뜀
I, [2025-02-06T06:19:20.380983 #1]  INFO -- : 누락된 after_code 훅을 건너뜀
I, [2025-02-06T06:19:20.383923 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown: 
I, [2025-02-06T06:19:20.386435 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown: 
I, [2025-02-06T06:19:20.389343 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown: 
I, [2025-02-06T06:19:20.391719 #1]  INFO -- : File > /root/install_postgres  chmod: +x  chown: 
I, [2025-02-06T06:19:20.394375 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown: 
I, [2025-02-06T06:19:20.394471 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 data_directory = '/var/lib/postgresql/15/main'을 data_directory = '/shared/postgres_data'로 대체
I, [2025-02-06T06:19:20.394742 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?listen_addresses *=.*)을 listen_addresses = '*'로 대체
I, [2025-02-06T06:19:20.394972 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?synchronous_commit *=.*)을 synchronous_commit = $db_synchronous_commit으로 대체
I, [2025-02-06T06:19:20.395126 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?shared_buffers *=.*)을 shared_buffers = $db_shared_buffers으로 대체
I, [2025-02-06T06:19:20.395261 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?work_mem *=.*)을 work_mem = $db_work_mem으로 대체
I, [2025-02-06T06:19:20.395400 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?default_text_search_config *=.*)을 default_text_search_config = '$db_default_text_search_config'로 대체
I, [2025-02-06T06:19:20.395510 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?checkpoint_segments *=.*)을 checkpoint_segments = $db_checkpoint_segments으로 대체
I, [2025-02-06T06:19:20.395622 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?logging_collector *=.*)을 logging_collector = $db_logging_collector으로 대체
I, [2025-02-06T06:19:20.395723 #1]  INFO -- : /etc/postgresql/15/main/postgresql.conf에서 (?-mix:#?log_min_duration_statement *=.*)을 log_min_duration_statement = $db_log_min_duration_statement으로 대체
I, [2025-02-06T06:19:20.395845 #1]  INFO -- : /etc/postgresql/15/main/pg_hba.conf에서 (?-mix:^#local +replication +postgres +peer$)을 local replication postgres  peer로 대체
I, [2025-02-06T06:19:20.395930 #1]  INFO -- : /etc/postgresql/15/main/pg_hba.conf에서 (?-mix:^host.*all.*all.*127.*$)을 host all all 0.0.0.0/0 md5로 대체
I, [2025-02-06T06:19:20.396007 #1]  INFO -- : /etc/postgresql/15/main/pg_hba.conf에서 (?-mix:^host.*all.*all.*::1\/128.*$)을 host all all ::/0 md5로 대체
I, [2025-02-06T06:19:20.396096 #1]  INFO -- : > if [ -f /root/install_postgres ]; then
  /root/install_postgres && rm -f /root/install_postgres
elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then
  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
fi

initdb: 경고: 로컬 연결에 대해 "trust" 인증을 활성화합니다
initdb: 힌트: pg_hba.conf를 편집하거나 -A 옵션 또는 --auth-local 및 --auth-host 옵션을 사용하여 다음 initdb 실행 시 이를 변경할 수 있습니다.

재구축이 이 지점에서 멈춰 있는 건가요? 그렇다면 재구축을 취소하고 대신 다음 명령어를 실행한 후 결과를 게시해 주세요.

./launcher start data
./launcher enter data
psql --version
apt-get update

감사합니다. docker 버전과 postgres.template.yml로 돌아가겠습니다.

./launcher rebuild data
x86_64 arch detected.
Ensuring launcher is up to date
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 600 data
data
2.0.20250129-0720: Pulling from docker-hub-china/discourse-base
Digest: sha256:d798a945ca4d31c29e5d263cdaf807bafab9b5f6737be0b1b852bea0063a3b91
Status: Image is up to date for registry.cn-wulanchabu.aliyuncs.com/docker-hub-china/discourse-base:2.0.20250129-0720
registry.cn-wulanchabu.aliyuncs.com/docker-hub-china/discourse-base:2.0.20250129-0720
/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups.rb
/usr/local/bin/pups --stdin
I, [2025-02-06T07:02:42.768651 #1]  INFO -- : Reading from stdin
I, [2025-02-06T07:02:42.769907 #1]  INFO -- : Skipped missing before_code hook
I, [2025-02-06T07:02:42.769923 #1]  INFO -- : Skipped missing before_db_migrate hook
I, [2025-02-06T07:02:42.769933 #1]  INFO -- : Skipped missing after_code hook
I, [2025-02-06T07:02:42.772767 #1]  INFO -- : File > /etc/service/postgres/run  chmod: +x  chown: 
I, [2025-02-06T07:02:42.775230 #1]  INFO -- : File > /etc/service/postgres/log/run  chmod: +x  chown: 
I, [2025-02-06T07:02:42.777690 #1]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x  chown: 
I, [2025-02-06T07:02:42.779645 #1]  INFO -- : File > /root/install_postgres  chmod: +x  chown: 
I, [2025-02-06T07:02:42.781825 #1]  INFO -- : File > /root/upgrade_postgres  chmod: +x  chown: 
I, [2025-02-06T07:02:42.781974 #1]  INFO -- : Replacing data_directory = '/var/lib/postgresql/15/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-06T07:02:42.782261 #1]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-06T07:02:42.782427 #1]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-06T07:02:42.782551 #1]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-06T07:02:42.782661 #1]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-06T07:02:42.782762 #1]  INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-06T07:02:42.782877 #1]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-06T07:02:42.782974 #1]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-06T07:02:42.783076 #1]  INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/15/main/postgresql.conf
I, [2025-02-06T07:02:42.783180 #1]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/15/main/pg_hba.conf
I, [2025-02-06T07:02:42.783258 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/15/main/pg_hba.conf
I, [2025-02-06T07:02:42.783334 #1]  INFO -- : Replacing (?-mix:^host.*all.*all.*::1\/128.*$) with host all all ::/0 md5 in /etc/postgresql/15/main/pg_hba.conf
I, [2025-02-06T07:02:42.783416 #1]  INFO -- : > if [ -f /root/install_postgres ]; then
  /root/install_postgres && rm -f /root/install_postgres
elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then
  socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
fi

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

2.0.20250129-0720: docker-hub-china/discourse-base에서 가져오는 중

서버가 중국에 있는지 확인해 주시겠습니까?

미러 사용에는 문제가 없습니다. 이것이 바로 중국 네트워크 가속 방법이며, 그렇지 않으면 미러에 네트워크 속도가 없습니다.

질문 내용을 새로운 주제로 옮겼습니다. 중국에서 업데이트를 실행하는 것과 관련이 있을 것 같습니다.

로그 출력에 따르면, 재빌드(rebuild)가 apt-get update 단계에서 실패하는 것으로 보입니다. 서버를 apt 리포지토리에 연결하기 위해 VPN을 사용하는 것을 권장합니다.

apt-get update를 위해 중국 네트워크 가속 과정도 수행하고 있습니다. apt-get update에서 주로 업데이트되는 소프트웨어가 무엇인지 알고 싶습니다.

/shared/postgres_run/.s.PGSQL.5432에 연결할 수 없는 근본 원인이 무엇인지 더 알고 싶습니다.

서버에서 아래 저장소에 접근할 수 있나요?

curl -v https://apt.postgresql.org/pub/repos/apt/

이 저장소는 업데이트 과정에서 사용되는 구버전 PostgreSQL 패키지를 설치하는 데 필요합니다.

이러한 문제는 데이터베이스가 올바르게 종료되지 않았을 때 발생하는 경우가 많습니다. data 컨테이너를 시작하고 종료했을 때 이미 이 문제를 수정해 두었습니다. 현재 최신 로그 출력에서는 해당 오류가 확인되지 않습니다.

PostgreSQL 버전이 너무 오래되어 문제를 일으킨다는 말씀이시죠? 이 업그레이드를 미러의 Discourse/base 처리에 통합할 수 있습니다. 저는 미러의 Discourse/base: 2.0.20250129-0720을 사용하고 있습니다.

제 이해에 문제가 있을까요? 정상적으로 작동하는 PostgreSQL 버전과 문제가 발생하는 PostgreSQL 버전의 번호는 각각 무엇인가요?

아니면, 제가 사용하는 미러가 너무 최신이라 데이터 빌드 과정에서 문제가 발생하는 것일 수도 있습니다. PostgreSQL 업그레이드에 대응하기 위해 데이터 빌드를 위해 미러 Discourse/base: 2.0.20250114-0014를 사용해야 합니다.

PostgreSQL 15 업그레이드를 수행했습니다

템플릿은 순서대로 사용해야 합니다

postgres.13.template.yml
postgres.15.template.yml
postgres.template.yml

postgres.13.template.yml, postgres.15.template.yml 파일 중국 네트워크 가속 구성

run:
  - exec: cat /etc/os-release && psql --version
  - exec: |
      if [ -f /etc/apt/sources.list ]; then
        sudo sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
      else
        echo "deb http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free non-free-firmware" | sudo tee /etc/apt/sources.list
        echo "deb http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free non-free-firmware" | sudo tee -a /etc/apt/sources.list
      fi
  - exec: |
      if [ -f /etc/apt/sources.list.d/debian.sources ]; then
        sudo sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
      else
        sudo bash -c 'cat > /etc/apt/sources.list.d/debian.sources <<EOF
        URIs: http://mirrors.ustc.edu.cn/debian
        Suites: bookworm bookworm-updates
        Components: main contrib non-free non-free-firmware
        Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

        Types: deb
        URIs: http://mirrors.ustc.edu.cn/debian-security
        Suites: bookworm-security
        Components: main contrib non-free non-free-firmware
        Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
        EOF'
      fi
  - exec: cat /etc/apt/sources.list && cat /etc/apt/sources.list.d/debian.sources