Postgresql

pg_upgradecluster 的問題

  • January 19, 2022

星期五我使用pg_upgradecluster(在 Debian Buster 上)從 PostgreSQL 13 升級到 14。這很有效,所以今天我想升級另一台伺服器(Linux Mint 20.3 Cinnamon)。這一次它不起作用。這是我所做的:

root@farao:~# pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
13  main    5432 online postgres /srv/local/postgresql/13    /var/log/postgresql/postgresql-13-main.log
14  main    5433 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
root@farao:~# pg_dropcluster --stop 14 main
root@farao:~# pg_upgradecluster -V -v 13 main /srv/local/postgresql/data/14
Use of uninitialized value $newversion in string eq at /usr/bin/pg_upgradecluster line 398.
Use of uninitialized value $_[0] in concatenation (.) or string at /usr/share/perl5/PgCommon.pm line 1049.
Stopping old cluster...
Restarting old cluster with restricted connections...
Notice: extra pg_ctl/postgres options given, bypassing systemctl for start operation
Use of uninitialized value $argv[10] in system at /usr/bin/pg_upgradecluster line 461.
Error: invalid version ''
Error: Could not create target cluster
root@farao:~# pg_lsclusters
Ver Cluster Port Status Owner    Data directory           Log file
13  main    5432 online postgres /srv/local/postgresql/13 /var/log/postgresql/postgresql-13-main.log
root@farao:~# ps -ef | grep postgres
postgres   24351    1306  0 20:57 ?        00:00:00 /usr/lib/postgresql/13/bin/postgres -D /srv/local/postgresql/13 -c config_file=/etc/postgresql/13/main/postgresql.conf -c hba_file=/tmp/pg_hba.UabjBQ.conf
postgres   24353   24351  0 20:57 ?        00:00:00 postgres: 13/main: checkpointer 
postgres   24354   24351  0 20:57 ?        00:00:00 postgres: 13/main: background writer 
postgres   24355   24351  0 20:57 ?        00:00:00 postgres: 13/main: walwriter 
postgres   24356   24351  0 20:57 ?        00:00:00 postgres: 13/main: autovacuum launcher 
postgres   24357   24351  0 20:57 ?        00:00:00 postgres: 13/main: stats collector 
postgres   24358   24351  0 20:57 ?        00:00:00 postgres: 13/main: logical replication launcher 
root       24488   18929  0 20:58 pts/0    00:00:00 grep --color=auto postgres
root@farao:~# cat /tmp/pg_hba.UabjBQ.conf
local all postgres ident
root@farao:~# pg_upgradecluster -V -v 13 main /srv/local/postgresql/data/14
Use of uninitialized value $newversion in string eq at /usr/bin/pg_upgradecluster line 398.
Use of uninitialized value $_[0] in concatenation (.) or string at /usr/share/perl5/PgCommon.pm line 1049.
Stopping old cluster...
Restarting old cluster with restricted connections...
Notice: extra pg_ctl/postgres options given, bypassing systemctl for start operation
Use of uninitialized value $argv[10] in system at /usr/bin/pg_upgradecluster line 461.
Error: invalid version ''
Error: Could not create target cluster
root@farao:~# pg_upgradecluster
Usage: /usr/bin/pg_upgradecluster [OPTIONS] <old version> <cluster name> [<new data directory>]
root@farao:~# 

沒有-V參數,結果是一樣的。我做錯什麼了?我需要安裝 PERL 模組嗎?

備註我只記得我只安裝了 postgresql-13 並使用了仍然存在的數據庫和配置。PostgreSQL 是否在某處儲存有關它創建的集群的資訊initdb?不合邏輯,因為pg_lsclusters可以找到它。

根據我在 的man頁面中閱讀的內容pg_upgradecluster,您的命令中可能存在拼寫錯誤。

以下是手冊頁的概要:

pg_upgradecluster [-v newversion] oldversion name [newdatadir]

保留-v並明確添加新版本號:

pg_upgradecluster -V -v 14 13 main /srv/local/postgresql/data/14

-v完全刪除(將預設為最新的可用版本):

pg_upgradecluster -V 13 main /srv/local/postgresql/data/14

引用自:https://dba.stackexchange.com/questions/306145