macos - 启动 Postgres 服务器

标签 macos postgresql server

我没有成功启动 postgres 服务器。我可以从终端向 postgres 添加新的数据库、表等,但不能通过网页向表中添加内容。该网页目前在本地主机上运行。

postgres 数据文件夹最初是在 root 用户中创建的,但我将其移至我自己的用户帐户并解决了很多问题,但我又回到了进入 postgres 后不断出现的旧错误 - D data(数据为数据簇文件夹)

EDT LOG:  could not bind IPv4 socket: Address already in use
2015-06-18 11:11:35 EDT HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2015-06-18 11:11:35 EDT LOG:  could not bind IPv6 socket: Address already in use
2015-06-18 11:11:35 EDT HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2015-06-18 11:11:35 EDT WARNING:  could not create listen socket for "*"
2015-06-18 11:11:35 EDT FATAL:  could not create any TCP/IP sockets

我尝试了两个不同的命令来启动服务器。

pg_ctl -D data -l logfile start 

这给了我这个,但它不正确

server starting

pg_ctl -D /Library/PostgreSQL/9.4/data -l log file start

这给了我这个

LOG:  skipping missing configuration file "/Library/PostgreSQL/9.4/data/postgresql.auto.conf"
pg_ctl: another server might be running; trying to start server anyway
server starting

postgresql.auto.conf 文件绝对是正确的名称和一切。如果我尝试停止假定启动的服务器,它会导致我尝试的第一个命令中的第一个服务器和第二个命令中的第二个停止。

Is server running?

LOG:  skipping missing configuration file "/Library/PostgreSQL/9.4/data/postgresql.auto.conf"
pg_ctl: could not send stop signal (PID: 83): Operation not permitted

最佳答案

某些东西似乎已经在使用端口 5432

尝试找出哪个程序(可能是 postgres 的另一个实例)正在阻塞该端口并决定是否停止该其他进程。

作为替代方案,重新配置 postgres 以使用其他端口。

也许您可以通过在控制台中输入以下内容来找出阻止该端口的原因:

lsof -n -i4TCP:5432 | grep LISTEN

关于macos - 启动 Postgres 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30941354/

相关文章:

python - Selenium Chrome 、Python。在网站上找不到该按钮

cocoa - 独立的、可启动的 OS X 应用程序

python - 如何在 Web 应用程序的 Docker 镜像中安装并启动 CouchDB 服务器?

MySQL 配置。需要很多连接

c++ - WebSocket,解码数据帧(c++)

git fetch --tags --progress 在 Jenkins 中超时,在命令行上工作正常

macos - OSX Catalina 上的 CronJobs 未执行

sql - 使用产生两列的子查询删除(在 Postgresql 中)

spring - 使用带有 H2 的序列导致无法找到要检索的行

sql - 为什么 PostgreSQL 查询在第一个新连接后的第一个请求中比在后续请求中慢?