|
症状: [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 启动成功!问题已解决
|
|
配置文件已经被覆盖。所以需要重新改配置文件。
|