请原谅我在Ubuntu和Postgresql方面的平庸知识。我有一个带有Ubuntu14.04.5LTS(GNU/Linux2.6.32-042stat127.2 x86_64)的VPS,还安装了Postgresql。我在rails应用程序中使用Postgresql。一旦我重新启动了ubuntu
$sudo重启
突然,我的应用程序和Postgresql数据库停止运行,抛出错误
无法连接到服务器:没有这样的文件或目录是服务器在本地运行并接受Unix域套接字上的连接"/var/run/postgresql/.s.PGSQL.5432“吗?
$ sudo -i -u postgres
$ 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"?
$psql -V
psql (PostgreSQL) 11.0 (Ubuntu 11.0-1.pgdg14.04+2)
$pg_config --version
PostgreSQL 11.0 (Ubuntu 11.0-1.pgdg14.04+2)
$postgres -V
The program 'postgres' is currently not installed. You can install it by typing:
apt-get install postgres-xc
$locate bin/postgres
/usr/lib/postgresql/11/bin/postgres
/usr/lib/postgresql/9.3/bin/postgres
/usr/lib/postgresql/9.4/bin/postgres
/usr/lib/postgresql/9.5/bin/postgres
$/usr/lib/postgresql/11/bin/postgres -V
postgres (PostgreSQL) 11.0 (Ubuntu 11.0-1.pgdg14.04+2)
$pg_lsclusters
9.3 main 5432 down postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log
11 main 5433 down postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.logpostgres状态下降
$service postgresql status
9.3/main (port 5432): down
11/main (port 5433): down
$systemctl status postgresql.service
postgresql.service
Loaded: error (Reason: No such file or directory)
Active: inactive (dead)
$systemctl status postgresql@9.3-main.service
postgresql@9.3-main.service
Loaded: error (Reason: No such file or directory)
Active: inactive (dead)$grep -H '^port‘/etc/postgresql/*/main/postgresql.conf /etc/postgresql/11/main/postgresql.conf:端口= 5433 /etc/postgresql/9.3/main/postgresql.conf:port = 5432
我正在尝试用PostgreSQL9.3启动
$service postgresql start 9.3
* Starting PostgreSQL 9.3 database server
* Failed to issue method call: Unit postgresql@9.3-main.service failed
to load: No such file or directory. See system logs and 'systemctl
status postgresql@9.3-main.service' for details.
$sudo systemctl start postgresql
Failed to issue method call: Unit postgresql.service failed to load: No
such file or directory. See system logs and 'systemctl status
postgresql.service' for details.
$/etc/init.d/postgresql start
* Starting PostgreSQL 11 database server
* Failed to issue method call: Unit postgresql@11-main.service failed to
load: No such file or directory. See system logs and 'systemctl status
postgresql@11-main.service' for details.
[fail]
* Starting PostgreSQL 9.3 database server
* Failed to issue method call: Unit postgresql@9.3-main.service failed to
load: No such file or directory. See system logs and 'systemctl status
postgresql@9.3-main.service' for details.
[fail]我无法启动PostgreSQL.I。我不明白为什么它突然下降,直到yesterday.Any帮助得到高度赞赏,它才能正常工作。提前谢谢!
发布于 2018-11-05 04:37:28
看起来,postgresql 11正在PORT=5433上运行,因此需要更改PGPORT变量。
导出PGPORT=5433
或
将PGPORT=5433添加到/etc/环境
sudo vim /etc/环境
PGPORT=5433
发布于 2021-07-07 09:17:18
我想出了一个解决方案来安装这个依赖关系来使用postgresql。
sudo apt-get install libpq-dev python3-dev用这个来安装它们
因为Linux用户需要安装一些依赖关系,PostgreSQL才能使用Python。
https://stackoverflow.com/questions/53089492
复制相似问题