[英]I can't start server PostgreSQL 11: "pg_ctl: could not start server"
我在 CentOS Linux 版本 7.5.1804(核心)
當我以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?
我需要安裝其他軟件嗎?
logfile
不是字面上的,它應該替換為 PostgreSQL 服務器進程具有寫入權限的文件。
您通常不會那樣做,而是編輯postgresql.conf
並配置log_destination
、 logging_collector
、 log_directory
和log_filename
。 然后你在沒有-l
選項的情況下啟動 PostgreSQL。
您嘗試使用systemctl
啟動 PostgreSQL 可能確實有效; 你可以檢查
systemctl status postgresql-11
所以,我遇到了同樣的問題。 首先,我使用以下命令檢查我的機器上是否以及所有服務器都處於活動狀態:
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
對我來說很好用!! 在此處輸入圖片說明
我認為有一個后台 postgres 進程正在運行,首先你需要終止這個服務。 我有同樣的問題並通過這個命令修復:
sudo /etc/init.d/postgresql stop
然后您可以將服務器啟動為:
sudo -u <your-username> pg_ctl -D <your-database-file-location> start
一個例子:
sudo -u shc /home/shc/postgres-built/bin/pg_ctl -D /home/shc/mydatabase start
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.