服务器是否在主机

服务器是否在主机

本文介绍了服务器是否在主机“ localhost”上运行? (:: 1)并在端口5432上接受TCP / IP连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在进行任何操作之前,请注意,我在Stack Overflow和整个网络上的文章中发现了几个类似的问题,但是没有一个问题能帮助我解决问题:

Before anything, please note that I have found several similar questions on Stack Overflow and articles all over the web, but none of those helped me fix my issue:





  • PG Error could not connect to server: Connection refused Is the server running on port 5432?
  • PG::ConnectionBad - could not connect to server: Connection refused
  • psql: could not connect to server: Connection refused

现在,这是问题所在:


  • 我有一个像魅力。

  • 与我的合作伙伴一起,我们使用GitHub进行协作。

  • 我们有 master mvp 分支。

  • 我最近更新了<$带有Homebrew(Mac)的c $ c> git 版本。

  • 我们使用Foreman在本地启动我们的应用。

  • I have a Rails app that works like a charm.
  • With my collaborator, we use GitHub to work together.
  • We have a master and an mvp branches.
  • I recently updated my git version with Homebrew (Mac).
  • We use Foreman to start our app locally.

现在,当我尝试在本地启动应用程序时,出现以下错误:

Now, when I try to launch the app locally, I get the following error:

PG::ConnectionBad at /
could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?

我尝试过多次重启计算机。

I tried to reboot my computers several times.

我还检查了 / usr / local / var / postgres 的内容:

PG_VERSION      pg_dynshmem     pg_multixact    pg_snapshots    pg_tblspc       postgresql.conf
base            pg_hba.conf     pg_notify       pg_stat         pg_twophase     postmaster.opts
global          pg_ident.conf   pg_replslot     pg_stat_tmp     pg_xlog         server.log
pg_clog         pg_logical      pg_serial       pg_subtrans     postgresql.auto.conf

如您所见,没有 postmaster.pid 文件。

有什么办法可以解决吗?

Any idea how I could fix this?

推荐答案

您很可能没电了,并且您的Postgresql服务器没有正确关闭。

You most likely ran out of battery and your postgresql server didn't shutdown correctly.

最简单的解决方法是下载官方的postgresql应用程序并启动它:它将强制服务器启动()

The easiest workaround is to download the official postgresql app and launch it: it will force the server to start (http://postgresapp.com/)

这篇关于服务器是否在主机“ localhost”上运行? (:: 1)并在端口5432上接受TCP / IP连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 21:16