服务器是否在主机“localhost"上运行?(::1) 并接受端口 5432 上的 TCP/IP 连接? [英] Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

查看:80
本文介绍了服务器是否在主机“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:

现在,问题来了:

  • 我有一个非常棒的 Rails 应用.
  • 与我的合作者一起,我们使用 GitHub 一起工作.
  • 我们有一个 master 和一个 mvp 分支.
  • 我最近使用 Homebrew (Mac) 更新了我的 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 文件.

As you can see, there is no postmaster.pid file in there.

知道如何解决这个问题吗?

Any idea how I could fix this?

推荐答案

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

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

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

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 连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆