|
癥狀: [octopus@pc3 ~]$ sudo service postgresql start Redirecting to /bin/systemctl start postgresql.service Job for postgresql.service failed. See "systemctl status postgresql.service" and "journalctl -xe" for details.
|
|
癥狀2: [octopus@pc3 ~]$ psql psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
|
|
其實問題的根源是我今天在執行sudo dnf update時無意中發現的: -------------------------------------------------------------------------------- Total 116 kB/s | 75 MB 10:58 Delta RPMs reduced 258.5 MB of updates to 74.7 MB (71.1% saved) Running transaction check Transaction check succeeded. Running transaction test Error: Transaction check error: file /usr/share/doc/postgresql/README.rpm-dist conflicts between attempted installs of postgresql-9.4.4-1.fc22.i686 and postgresql-9.4.4-1.fc22.x86_64
Error Summary ------------- 這是因為出現了conflicts,系統中同時安裝了postgresql-9.4.4-1.fc22.i686 and postgresql-9.4.4-1.fc22.x86_64兩個版本而出錯。因此只需卸載其中一個版本即可。
|
|
[octopus@pc3 ~]$ sudo dnf remove postgresql-9.4.3-1.fc22.x86_64 Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Removing: postgresql x86_64 9.4.3-1.fc22 @System 3.8 M postgresql-devel x86_64 9.4.3-1.fc22 @System 4.3 M postgresql-docs x86_64 9.4.3-1.fc22 @System 23 M postgresql-server x86_64 9.4.3-1.fc22 @System 17 M postgresql-upgrade x86_64 9.4.3-1.fc22 @System 9.1 M
Transaction Summary ================================================================================ Remove 5 Packages
Installed size: 58 M Is this ok [y/N]: n Operation aborted.
|
|
[octopus@pc3 ~]$ sudo dnf remove postgresql-9.4.3-1.fc22.i686 Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Removing: postgresql i686 9.4.3-1.fc22 @System 3.7 M
Transaction Summary ================================================================================ Remove 1 Package
Installed size: 3.7 M Is this ok [y/N]: y Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Erasing : postgresql-9.4.3-1.fc22.i686 1/1 Verifying : postgresql-9.4.3-1.fc22.i686 1/1
Removed: postgresql.i686 9.4.3-1.fc22
Complete!
|
|
因為卸載postgresql-9.4.3-1.fc22.i686時只卸載一樣東西,而卸載postgresql-9.4.3-1.fc22.x86_64需要卸載所有的有關psql的東西。所以只卸載i686那個不完整版本。執行: sudo dnf remove postgresql-9.4.3-1.fc22.i686
|
|
然後升級數據庫: [octopus@pc3 ~]$ sudo postgresql-setup --upgrade * 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. * See /var/lib/pgsql/upgrade_postgresql.log for details.
|
|
[octopus@pc3 ~]$ sudo service postgresql start Redirecting to /bin/systemctl start postgresql.service 啟動成功!問題已解決
|
|
配置文件已經被覆蓋。所以需要重新改配置文件。
|