9

我在 CentOS Linux 版本 7.5.1804 (Core)

当我登录postgres并运行时:

bash-4.2$ /usr/pgsql-11/bin/initdb -D /var/lib/pgsql/11/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /var/lib/pgsql/11/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/pgsql-11/bin/pg_ctl -D /var/lib/pgsql/11/data -l logfile start

bash-4.2$

然后我跑

bash-4.2$ /usr/pgsql-11/bin/pg_ctl start -l logfile -D /var/lib/pgsql/11/data
waiting for server to start..../bin/sh: logfile: Permission denied
 stopped waiting
pg_ctl: could not start server
Examine the log output.
bash-4.2$ date
Wed Oct 24 01:50:44 -05 2018
bash-4.2$

我在 GOOGLE 中搜索“等待服务器启动..../bin/sh: logfile: Permission denied”但是这个错误只发生在 MAC 中并且没有显示解决方案...

我也跑

bash-4.2$ postgres --version;postmaster --version;
postgres (PostgreSQL) 11.0
postgres (PostgreSQL) 11.0
bash-4.2$

然后我相信 PostgreSQL 11 安装得很好,但我无法启动服务器。

我用这条线安装:

yum install postgresql-jdbc.noarch postgresql-jdbc-javadoc.noarch postgresql-unit11.x86_64 postgresql-unit11-debuginfo.x86_64 postgresql11.x86_64 postgresql11-contrib.x86_64 postgresql11-debuginfo.x86_64 postgresql11-devel.x86_64 postgresql11-docs.x86_64 postgresql11-libs.x86_64 postgresql11-odbc.x86_64 postgresql11-plperl.x86_64 postgresql11-plpython.x86_64 postgresql11-pltcl.x86_64 postgresql11-server.x86_64 postgresql11-tcl.x86_64 postgresql11-test.x86_64

我没有添加 [postgresql11-llvmjit.x86_64] 因为这需要很多依赖。

CentOS Linux 版本 7.5.1804 + PostgreSQL 11 ?

我需要安装其他软件吗?

4

2 回答 2

7

logfile不是字面意思,它应该替换为PostgreSQL服务器进程具有写权限的文件。

您通常不会这样做,而是编辑和postgresql.conf配置log_destination,logging_collector和. 然后在没有该选项的情况下启动 PostgreSQL 。log_directorylog_filename-l

您尝试启动 PostgreSQLsystemctl可能确实有效;你可以检查

systemctl status postgresql-11
于 2018-10-24T17:07:24.370 回答
6

所以,我遇到了同样的问题。首先,我使用以下命令检查我的机器上是否所有服务器都处于活动状态以及哪些服务器处于活动状态:

brew services list

然后我有一些服务器处于活动状态,所以我停止了它们,因为您需要停止它们才能使 posgresql 服务器工作。

brew services stop < name of the server/s active >

然后我创建了一个新数据库

initdb /usr/local/var/postgres2

并使用启动服务器

 pg_ctl -D /usr/local/var/postgres2 -l logfile start

对我来说工作得很好! 在此处输入图像描述

于 2020-02-18T23:49:52.743 回答