我没有Linux的经验,我希望有人可以帮助解决这个问题。
我有一个虚拟机与Ubuntu 16.04 LTS和使用PostegreSQL 9.5的应用程序。 在过去的几个月里一切正常。
然而,上个周末一个电源故障closures所有电脑,当我打开服务器,我注意到,PostegreSQL它没有启动。
当我运行命令
psql taiga -U postgres
我明白了
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"?
启动命令不会返回任何错误
/etc/init.d/postgresql start [ ok ] Starting postgresql (via systemctl): postgresql.service.
状态一显示服务没有运行
sudo service postgresql status ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor prese Active: active (exited) since Seg 2017-07-03 13:04:43 BRT; 7min ago Process: 826 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 826 (code=exited, status=0/SUCCESS) CGroup: /system.slice/postgresql.service Jul 03 13:04:43 vmtaiga systemd[1]: Starting PostgreSQL RDBMS... Jul 03 13:04:43 vmtaiga systemd[1]: Started PostgreSQL RDBMS.
让服务器运行的唯一方法是使用命令
sudo su - postgres postgres@vmtaiga:~$ /usr/lib/postgresql/9.5/bin/postgres -d 3 -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf
之后,我可以连接到数据库,但是如果我closuresterminal服务将停止。
请任何人都可以帮我解决这个问题?