Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos Postgres服务器在我的Mac上启动和停止_Macos_Postgresql - Fatal编程技术网

Macos Postgres服务器在我的Mac上启动和停止

Macos Postgres服务器在我的Mac上启动和停止,macos,postgresql,Macos,Postgresql,我已经在我的Mac上安装了Postgres server 9.4的新版本。我现在想从命令行手动启动和停止它。在我的.bash_概要文件中定义了以下内容(当然也添加了路径) 当我尝试启动服务器时,我得到以下信息 Joes-MacBook-Pro:~ postgres$ /Library/PostgreSQL/9.4/bin/pg_ctl -D /Library/PostgreSQL/9.4/data -l logfile start pg_ctl: another server might be

我已经在我的Mac上安装了Postgres server 9.4的新版本。我现在想从命令行手动启动和停止它。在我的.bash_概要文件中定义了以下内容(当然也添加了路径)

当我尝试启动服务器时,我得到以下信息

Joes-MacBook-Pro:~ postgres$ /Library/PostgreSQL/9.4/bin/pg_ctl -D /Library/PostgreSQL/9.4/data -l logfile start
pg_ctl: another server might be running; trying to start server anyway
server starting
Joes-MacBook-Pro:~ postgres$ /bin/sh: logfile: Permission denied
当我试图查看是否有任何服务器正在运行时:

Joes-MacBook-Pro:~ postgres$ /Library/PostgreSQL/9.4/bin/pg_ctl status
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.
以下是更多信息:

Joes-MacBook-Pro:~ postgres$ ps x | grep postgres
  263   ??  Ss     0:27.28 postgres: logger process    
  265   ??  Ss     2:04.57 postgres: writer process    
  266   ??  Ss     1:35.49 postgres: wal writer process    
  267   ??  Ss     0:21.52 postgres: autovacuum launcher process    
  268   ??  Ss     0:20.12 postgres: stats collector process    
29416   ??  Ss     0:00.00 postgres: logger process    
29418   ??  Ss     0:00.01 postgres: checkpointer process    
29419   ??  Ss     0:00.09 postgres: writer process    
29420   ??  Ss     0:00.03 postgres: wal writer process    
29421   ??  Ss     0:00.03 postgres: autovacuum launcher process    
29422   ??  Ss     0:00.08 postgres: stats collector process    
31113 s000  S+     0:00.00 grep postgres

这让我难以置信。我如何确保可以从Mac电脑上的命令提示符手动启动和停止Postgres服务器?

您已将第三方代码安装到
/Library
?那是自找麻烦。我建议使用自制的Macports来安装第三方工具。我刚刚下载了Postgres dmg文件,并按照默认说明进行了操作。我想我可以摆脱它,在我首选的目录中重新安装。我完全摆脱了Postgres。我现在正在尝试新的安装。让我看看是否可以把它安装到我选择的目录中!您应该运行
lsof-i:5432
,以找到进程的pid。就个人而言,我使用和都很好。出于测试目的,我建议使用:。应用程序打开时,服务将运行。
Joes-MacBook-Pro:~ postgres$ ps x | grep postgres
  263   ??  Ss     0:27.28 postgres: logger process    
  265   ??  Ss     2:04.57 postgres: writer process    
  266   ??  Ss     1:35.49 postgres: wal writer process    
  267   ??  Ss     0:21.52 postgres: autovacuum launcher process    
  268   ??  Ss     0:20.12 postgres: stats collector process    
29416   ??  Ss     0:00.00 postgres: logger process    
29418   ??  Ss     0:00.01 postgres: checkpointer process    
29419   ??  Ss     0:00.09 postgres: writer process    
29420   ??  Ss     0:00.03 postgres: wal writer process    
29421   ??  Ss     0:00.03 postgres: autovacuum launcher process    
29422   ??  Ss     0:00.08 postgres: stats collector process    
31113 s000  S+     0:00.00 grep postgres