4

今日、Ubuntu サーバー上のすべてのソフトウェアをアップグレードしました。

sudo aptitude upgrade

アップグレードがうまくいかず、postgresql が開始されず、次のエラーが発生しました。

alex@db:~$ sudo service postgresql start
* Starting PostgreSQL 9.5 database server[fail]
* The PostgreSQL server failed to start. Please check the log output:
2015-10-30 12:42:09 MSK FATAL:  database files are incompatible with server
2015-10-30 12:42:09 MSK DETAIL:  The database cluster was initialized with CATALOG_VERSION_NO 201507281, but the server was compiled with CATALOG_VERSION_NO 201510051.
2015-10-30 12:42:09 MSK HINT:  It looks like you need to initdb.

アップグレード前にサーバー上にあった postgresql のバージョンは覚えていませんが、アップグレードの結果、1 つのデータ ディレクトリと 1 つのクラスターしか表示されませんでした。

alex@db:~$ ls /var/lib/postgresql/
9.5  Maildir

alex@db:~$ pg_lsclusters 
Ver Cluster Port Status Owner    Data directory               Log file
9.5 main    5432 down   postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log

というわけで、マイナーアップデートだったようです。

data dir をどこかにコピーして を実行したinitdb後、aptitude upgrade再び 9.4 クラスターが作成されていることに気付きました。

alex@db:~$ sudo cp /var/lib/postgresql/9.5/main /var/lib/postgresql/9.5/main.old
alex@db:~$ sudo /usr/lib/postgresql/9.5/bin/initdb -D /var/lib/postgresql/9.5/main/
alex@db:~$ sudo aptitude upgrade
alex@db:~$ ls /var/lib/postgresql/
9.4  9.5  Maildir
alex@db:~$ pg_lsclusters 
Ver Cluster Port Status Owner    Data directory               Log file
9.4 main    5433 down   postgres /var/lib/postgresql/9.4/main /var/log/postgresql/postgresql-9.4-main.log
9.5 main    5432 down   postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log

今は問題なく動作していますが、保存したデータを /var/lib/postgresql/9.5/main.old から復元するにはどうすればよいですか? pg_upgrade が機能しません。そして...はい、アップグレードする前にバックアップを作成しませんでした。

更新: の内容/etc/apt/sources.list

#######################################################################################
# Hetzner APT-Mirror
#
deb http://mirror.hetzner.de/ubuntu/packages trusty main restricted universe multiverse
deb http://mirror.hetzner.de/ubuntu/packages trusty-backports main restricted universe multiverse
deb http://mirror.hetzner.de/ubuntu/packages trusty-updates main restricted universe multiverse
deb http://mirror.hetzner.de/ubuntu/security trusty-security main restricted universe multiverse

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://de.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ trusty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ trusty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://de.archive.ubuntu.com/ubuntu/ trusty universe
deb http://de.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://de.archive.ubuntu.com/ubuntu/ trusty-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://de.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://de.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ trusty-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
# deb http://extras.ubuntu.com/ubuntu trusty main
# deb-src http://extras.ubuntu.com/ubuntu trusty main

deb http://packages.elasticsearch.org/elasticsearch/1.4/debian stable main

更新 2:

alex@db:~$ sudo dpkg -l postgresql\*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                      Version                           Architecture                      Description
+++-=========================================================-=================================-=================================-=======================================================================================================================
ii  postgresql                                                9.4+170.pgdg14.04+1               all                               object-relational SQL database (supported version)
un  postgresql-7.4                                            <none>                            <none>                            (no description available)
un  postgresql-8.0                                            <none>                            <none>                            (no description available)
un  postgresql-9.1                                            <none>                            <none>                            (no description available)
ii  postgresql-9.3                                            9.3.10-1.pgdg14.04+1              amd64                             object-relational SQL database, version 9.3 server
ii  postgresql-9.4                                            9.4.5-1.pgdg14.04+1               amd64                             object-relational SQL database, version 9.4 server
ii  postgresql-9.5                                            9.5~beta1-1.pgdg14.04+1           amd64                             object-relational SQL database, version 9.5 server
un  postgresql-client                                         <none>                            <none>                            (no description available)
ii  postgresql-client-9.3                                     9.3.10-1.pgdg14.04+1              amd64                             front-end programs for PostgreSQL 9.3
ii  postgresql-client-9.4                                     9.4.5-1.pgdg14.04+1               amd64                             front-end programs for PostgreSQL 9.4
ii  postgresql-client-9.5                                     9.5~beta1-1.pgdg14.04+1           amd64                             front-end programs for PostgreSQL 9.5
ii  postgresql-client-common                                  170.pgdg14.04+1                   all                               manager for multiple PostgreSQL client versions
ii  postgresql-common                                         170.pgdg14.04+1                   all                               PostgreSQL database-cluster manager
ii  postgresql-contrib                                        9.4+170.pgdg14.04+1               all                               additional facilities for PostgreSQL (supported version)
ii  postgresql-contrib-9.3                                    9.3.10-1.pgdg14.04+1              amd64                             additional facilities for PostgreSQL
ii  postgresql-contrib-9.4                                    9.4.5-1.pgdg14.04+1               amd64                             additional facilities for PostgreSQL
ii  postgresql-contrib-9.5                                    9.5~beta1-1.pgdg14.04+1           amd64                             additional facilities for PostgreSQL
ii  postgresql-doc                                            9.4+170.pgdg14.04+1               all                               documentation for the PostgreSQL database management system
ii  postgresql-doc-9.3                                        9.3.10-1.pgdg14.04+1              all                               documentation for the PostgreSQL database management system
ii  postgresql-doc-9.4                                        9.4.5-1.pgdg14.04+1               all                               documentation for the PostgreSQL database management system
un  postgresql-doc-9.5                                        <none>                            <none>                            (no description available)
ii  postgresql-server-dev-9.3                                 9.3.10-1.pgdg14.04+1              amd64                             development files for PostgreSQL 9.3 server-side programming


alex@db:~$ sudo apt-cache policy postgresql-9.5
postgresql-9.5:
  Installed: 9.5~beta1-1.pgdg14.04+1
  Candidate: 9.5~beta1-1.pgdg14.04+1
  Version table:
 *** 9.5~beta1-1.pgdg14.04+1 0
        500 http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg/main amd64 Packages
        100 /var/lib/dpkg/status
4

1 に答える 1

2

データベースのアルファ リリースを使用している/使用していましたが、これはformat-stable のままではないと明示的に文書化されています。ただし、それに気付かずにインストールするのは少し簡単すぎたようです。私はそれについて apt パッケージング チームにメールしました


更新:最初にインストールするときに使用するか、エントリに手動で追加するかaptitude install postgresql-9.5 明示的に行っている必要があります。9.5 パッケージはデフォルトではインストールされず、インストールには追加の手順が必要です。見る:--force9.5sources.list

フォーマットの変更に気付かずに指示に従った場合に備えて、wiki に警告を追加して更新しました。とはいえ、関心のあるデータを含むプレリリース データベースを使用することは、明らかに優れたアイデアとは言えません。


古いデータを読み取る必要がある場合は、実行していた特定のバージョンをダウンロードしてインストールし、それを使用してデータベースをダンプする必要があります。その後、それらを新しいコピーに復元できます。

データをダンプしてから PostgreSQL 9.4 に復元し、9.5.0がリリースされるまで、または少なくともベータ版がリリースされるまで、それを使い続けることを強くお勧めします。ベータ版の後、PostgreSQL チームはフォーマットの変更を避けるために懸命に努力しています。


更新:9.5~beta1-1.pgdg14.04+1現在実行中なので、9.5alpha2 から 9.5beta1 への更新で問題が発生したと確信しています。これは理にかなっています。

したがって、9.5alpha1 バージョンを見つけて、強制的にダウングレードする必要があります。これにより、再度アップグレードするまで 9.5beta2 データベースにアクセスできなくなることに注意してください。最初にダンプすることをお勧めします。

バージョンから、これが PGDG リリース、つまり apt.postgresql.org (PostgreSQL Development Group によって運営されている) からのリリースであることは明らかです。調べるhttp://apt.postgresql.org/pub/repos/apt/dists/trusty-pgdg/9.5/binary-amd64/Packagesと、現在のパッケージ リストが表示されますが、アルファ版は含まれていません。現在のリリースではなくなっているため、これは当然のことですが、そのリポジトリから直接ダウンロードすることはできません。ただし、これは にもありません。trusty-pgdg-testingまた、パッケージ プールにもありませんhttp://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-9.5/

つまり、アルファ版はリポジトリから完全に削除され、apt.postgresql.org からダウンロードできなくなりました。

最初に、まだアルファ版が にあるかどうかを確認してください/var/cache/apt/archives。その場合は、alpha2名前に が含まれるすべてのものを別の場所に今すぐコピーします。

そうでない場合は、自分でコンパイルするか、まだパッケージを持っている人がいないかメーリング リストで質問するかを選択できます。

于 2015-10-30T10:37:03.913 に答える