昨天我将 Fedora 从 19 升级到了 20。现在我无法启动 PostgreSQL,因为数据库格式太旧了。步骤如下:
1.
# systemctl start postgresql
Job for postgresql.service failed. See 'systemctl status postgresql.service' and 'journalctl -xn' for details.
2.
# journalctl -xn
postgresql-check-db-dir[30869]: An old version of the database format was found.
postgresql-check-db-dir[30869]: Use "postgresql-setup upgrade" to upgrade to version 9.3.
postgresql-check-db-dir[30869]: See /usr/share/doc/postgresql/README.rpm-dist for more information.
postgresql.service: control process exited, code=exited status=1
systemd[1]: Failed to start PostgreSQL database server.
3.
#postgresql-setup upgrade
Please install the postgresql-upgrade RPM.
4.
#yum install postgresql-upgrade
Загружены модули: auto-update-debuginfo, langpacks, refresh-packagekit
pgdg93 | 3.6 kB 00:00:00
rpmfusion-free-updates | 3.3 kB 00:00:00
rpmfusion-free-updates-debuginfo | 2.7 kB 00:00:00
rpmfusion-nonfree-updates | 3.3 kB 00:00:00
rpmfusion-nonfree-updates-debuginfo | 2.7 kB 00:00:00
updates/20/x86_64/metalink | 28 kB 00:00:00
updates-debuginfo/20/x86_64/metalink | 24 kB 00:00:00
pgdg93/20/x86_64/primary_db | 77 kB 00:00:00
rpmfusion-nonfree-updates/20/x86_64/primary_db
Package postgresql-upgrade not found.
我做错了什么? repo 太旧了吗?
答案1
我检查了我本地的 Fedora 镜像,发现 postgresql-upgrade RPM 确实存在于 Fedora 20 和 21 存储库中。
/srv/www/mirrors/fedora/releases/20/Everything/x86_64/os/Packages/p/postgresql-upgrade-9.3.1-2.fc20.x86_64.rpm
/srv/www/mirrors/fedora/releases/21/Everything/x86_64/os/Packages/p/postgresql-upgrade-9.3.5-4.fc21.x86_64.rpm
所以我怀疑您遇到了一个不好或不同步的镜像站点。您可以运行yum clean all
并重试,看看是否能找到不同的镜像站点。
这也可能是由于您安装pgdg93
了存储库而导致的。由于 Fedora 已经有 PostgreSQL 9.3,因此安装这个似乎没有什么意义,而且它的软件包可能会引起冲突。