設置 | 登錄 | 註冊

目前共有6篇帖子。

Fedora39升级到41后,PostgreSQL数据库无法启动的解决方法

1樓 巨大八爪鱼 2024-11-3 18:19
[octopus@pc3 ~]$ sudo systemctl status postgresql
× postgresql.service - PostgreSQL database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: failed (Result: exit-code) since Sun 2024-11-03 17:55:52 CST; 17min ago
 Invocation: b91d51e60771456d9da7b84547560ad6
    Process: 1779 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=1/FAILURE)
   Mem peak: 2.1M
        CPU: 46ms

Nov 03 17:55:51 pc3 systemd[1]: Starting postgresql.service - PostgreSQL database server...
Nov 03 17:55:52 pc3 postgresql-check-db-dir[1779]: An old version of the database format was found.
Nov 03 17:55:52 pc3 postgresql-check-db-dir[1779]: Use 'postgresql-setup --upgrade' to upgrade to version '16'
Nov 03 17:55:52 pc3 postgresql-check-db-dir[1779]: See /usr/share/doc/postgresql16/README.rpm-dist for more information.
Nov 03 17:55:52 pc3 systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE
Nov 03 17:55:52 pc3 systemd[1]: postgresql.service: Failed with result 'exit-code'.

Nov 03 17:55:52 pc3 systemd[1]: Failed to start postgresql.service - PostgreSQL database server.


需要升级PostgreSQL的数据文件夹。

2樓 巨大八爪鱼 2024-11-3 18:19
[octopus@pc3 ~]$ sudo dnf install postgresql-upgrade
Updating and loading repositories:
 Copr repo for PyCharm owned by phracek 100% |   5.4 KiB/s |   3.9 KiB |  00m01s
 google-chrome                          100% |  10.7 KiB/s |   3.3 KiB |  00m00s
 Fedora 41 openh264 (From Cisco) - x86_ 100% |   3.1 KiB/s |   4.8 KiB |  00m02s
 Fedora 41 - x86_64 - Updates           100% |   2.7 MiB/s |   2.9 MiB |  00m01s
 Fedora 41 - x86_64                     100% | 623.6 KiB/s |  35.2 MiB |  00m58s
 RPM Fusion for Fedora 41 - Nonfree - N 100% |  15.3 KiB/s |  24.8 KiB |  00m02s
 RPM Fusion for Fedora 41 - Nonfree - S 100% |  11.2 KiB/s |  20.4 KiB |  00m02s
 Fedora 41 - x86_64 - VirtualBox        100% |  18.8 KiB/s |  27.6 KiB |  00m01s
>>> Status code: 404 for http://download.virtualbox.org/virtualbox/rpm/fedora/41
>>> Status code: 404 for http://download.virtualbox.org/virtualbox/rpm/fedora/41
>>> Status code: 404 for http://download.virtualbox.org/virtualbox/rpm/fedora/41
>>> Status code: 404 for http://download.virtualbox.org/virtualbox/rpm/fedora/41
>>> Librepo error: Cannot download repomd.xml: Cannot download repodata/repomd.x
Repositories loaded.
Package                  Arch    Version                  Repository        Size
Removing:
 kernel                  x86_64  6.7.4-200.fc39           updates        0.0   B
 kernel-core             x86_64  6.7.4-200.fc39           updates       66.0 MiB
 kernel-devel            x86_64  6.7.4-200.fc39           updates       69.6 MiB
 kernel-modules          x86_64  6.7.4-200.fc39           updates       56.9 MiB
 kernel-modules-core     x86_64  6.7.4-200.fc39           updates       32.0 MiB
 kernel-modules-extra    x86_64  6.7.4-200.fc39           updates        2.4 MiB
Installing:
 postgresql-upgrade      x86_64  16.3-3.fc41              fedora        31.8 MiB
Installing dependencies:
 uuid                    x86_64  1.6.2-64.fc41            fedora       128.9 KiB

Transaction Summary:
 Installing:         2 packages
 Removing:           6 packages

Total size of inbound packages is 7 MiB. Need to download 7 MiB.
Is this ok [y/N]: y
[1/2] uuid-0:1.6.2-64.fc41.x86_64       100% |  83.7 KiB/s |  58.5 KiB |  00m01s
[2/2] postgresql-upgrade-0:16.3-3.fc41. 100% |  67.6 KiB/s |   7.4 MiB |  01m52s
--------------------------------------------------------------------------------
[2/2] Total                             100% |  67.9 KiB/s |   7.5 MiB |  01m53s
Running transaction
Importing PGP key 0xE99D6AD1:
 UserID     : "Fedora (41) <fedora-41-primary@fedoraproject.org>"
 Fingerprint: 466CF2D8B60BC3057AA9453ED0622462E99D6AD1
 From       : file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-41-x86_64
Is this ok [y/N]: y
The key was successfully imported.
[ 1/10] Verify package files            100% |  19.0   B/s |   2.0   B |  00m00s
[ 2/10] Prepare transaction             100% |   0.0   B/s |   8.0   B |  00m10s
[ 3/10] Installing uuid-0:1.6.2-64.fc41 100% | 538.0 KiB/s | 131.8 KiB |  00m00s
[ 4/10] Installing postgresql-upgrade-0 100% |  26.5 MiB/s |  31.9 MiB |  00m01s
[ 5/10] Erasing kernel-modules-extra-0: 100% |   7.0   B/s | 131.0   B |  00m18s
[ 6/10] Erasing kernel-0:6.7.4-200.fc39 100% |   1.7 KiB/s | 100.0   B |  00m00s
[ 7/10] Erasing kernel-modules-0:6.7.4- 100% | 350.0   B/s |   2.2 KiB |  00m06s
[ 8/10] Erasing kernel-modules-core-0:6 100% |   1.8 KiB/s |   3.0 KiB |  00m02s
[ 9/10] Erasing kernel-core-0:6.7.4-200 100% |   7.0   B/s |  17.0   B |  00m02s
[10/10] Erasing kernel-devel-0:6.7.4-20 100% |   1.1 KiB/s |  22.1 KiB |  00m21s
Complete!
[octopus@pc3 ~]$ sudo postgresql-setup --upgrade
[sudo] password for octopus:
 * Upgrading database.
 * Upgraded OK.
WARNING: The configuration files were replaced by default configuration.
WARNING: The previous configuration and data are stored in folder
WARNING: /var/lib/pgsql/data-old.
WARNING: If you've just upgraded your database from a previous major version of
Fedora or RHEL, please run reindexdb against your databases.  Core library
collation data may have changed and this will invalidate database indexes.  For
example, in Fedora 28 and RHEL 8 there have been extensive changes in glibc
collations to support ISO 14651:2016 (Unicode 9.0.0 data) and your indexes may
be affected: https://sourceware.org/ml/libc-announce/2018/msg00002.html
 * See /var/lib/pgsql/upgrade_postgresql.log for details.
巨大八爪鱼

先安装postgresql-upgrade软件包:sudo dnf install postgresql-upgrade。

再执行sudo postgresql-setup --upgrade命令。

3樓 巨大八爪鱼 2024-11-3 18:22

用sudo postgresql-setup --upgrade命令升级完PostgreSQL的数据文件夹之后,PostgreSQL数据库就能启动成功了。

[octopus@pc3 ~]$ sudo systemctl start postgresql

[octopus@pc3 ~]$ sudo systemctl status postgresql
● postgresql.service - PostgreSQL database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: active (running) since Sun 2024-11-03 18:14:30 CST; 47s ago
 Invocation: 83761f7c88b34cbcbf4ffc27894123bf
    Process: 4327 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS)
   Main PID: 4330 (postgres)
      Tasks: 7 (limit: 4306)
     Memory: 19.6M (peak: 21.5M)
        CPU: 230ms
     CGroup: /system.slice/postgresql.service
             ├─4330 /usr/bin/postgres -D /var/lib/pgsql/data
             ├─4331 "postgres: logger "
             ├─4332 "postgres: checkpointer "
             ├─4333 "postgres: background writer "
             ├─4335 "postgres: walwriter "
             ├─4336 "postgres: autovacuum launcher "
             └─4337 "postgres: logical replication launcher "

Nov 03 18:14:30 pc3 systemd[1]: Starting postgresql.service - PostgreSQL database server...
Nov 03 18:14:30 pc3 postgres[4330]: 2024-11-03 18:14:30.636 CST [4330] LOG:  redirecting log output to logging collector process
Nov 03 18:14:30 pc3 postgres[4330]: 2024-11-03 18:14:30.636 CST [4330] HINT:  Future log output will appear in directory "log".
Nov 03 18:14:30 pc3 systemd[1]: Started postgresql.service - PostgreSQL database server.
4樓 巨大八爪鱼 2024-11-3 18:29

javax.servlet.ServletException: org.postgresql.util.PSQLException: SCRAM authentication is not supported by this driver. You need JDK >= 8 and pgjdbc >= 42.2.0 (not ".jre" versions)

解决方案:https://zh.purasbar.com/post.php?t=29417



5樓 巨大八爪鱼 2024-11-3 18:46
[octopus@pc3 ~]$ psql -U postgres -W
Password:
WARNING:  database "postgres" has a collation version mismatch
DETAIL:  The database was created using collation version 2.38, but the operating system provides version 2.40.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
psql (16.3)
Type "help" for help.

postgres=# \q

內容轉換:

回覆帖子
內容:
用戶名: 您目前是匿名發表。
驗證碼:
看不清?換一張
©2010-2025 Purasbar Ver3.0 [手機版] [桌面版]
除非另有聲明,本站採用知識共享署名-相同方式共享 3.0 Unported許可協議進行許可。