簡體   English   中英

Linux上的PostgreSQL“initdb”(數據庫初始化)

[英]PostgreSQL “initdb” (Database Initialization) on Linux

我正在開發一個在Linux系統上運行的PostgreSQL 9.x中的數據庫集群(單個數據庫)(CentOS - RedHat - Fedora)。 我已經安裝了正確的PostgreSQL包(服務器和客戶端)但是,我無法創建數據庫並獲得某種類型的初始化依賴性錯誤:總線錯誤/退出代碼135 我用“su postgres”將我的用戶改為“postgres”,然后嘗試用“initdb”初始化數據庫(這可能是問題)

Installed: postgresql-libs-9.2.13-1.el7_1.x86_64
Installed: postgresql-9.2.13-1.el7_1.x86_64
Installed: postgresql-server-9.2.13-1.el7_1.x86_64

$ initdb -D /usr/local/pgsql/data

http://www.postgresql.org/docs/9.2/interactive/creating-cluster.html

錯誤:

$ initdb -D /usr/local/pgsql/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.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

creating directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... sh: line 1: 12616 Bus error               (core dumped) "/usr/bin/postgres" --single -F -O -c search_path=pg_catalog -c exit_on_error=true template1 > /dev/null
child process exited with exit code 135

有任何想法嗎?

安裝PostgreSQL(服務器和客戶端工具)后,需要運行以下命令作為ROOT(“su”)。 關鍵步驟是啟動“service postgresql initdb”並讓它初始化你的PostgreSQL數據庫。

如果您有任何錯誤,則需要刪除空安裝“data”目錄並仔細讀取所有日志文件。

# service postgresql initdb
# systemctl enable postgresql
# systemctl start postgresql

完成上述操作后,驗證postgres是在/ var / lib / pgsql中運行的進程是否為“ps -ef | grep postgres”(在端口5432上)

如果您遇到任何其他問題,您可能需要創建或修改postgres用戶/密碼或清理postgres數據目錄。

如果從軟件包安裝,則應使用軟件包提供的方法來創建數據庫。 對於README.rpm-dist記錄的PDGD RPMs(來自http://yum.postgresql.org/ ):

/usr/pgsql-9.4/bin/postgresql94-setup initdb

但是,你真正得到的錯誤不應該發生。 它表明硬件不兼容或低級別問題,如不兼容的C庫。 也許您從不同的操作系統或版本強制安裝RPM?

更新

似乎很可能是C庫不兼容。 也許RHEL和CentOS之間存在問題? 還是版本相關? 這是動態鏈接器中的錯誤。 dl-lookup.c將是glibc/elf/dl-lookup.c ,它似乎在符號查找期間崩潰。 所以這里有一些非常不穩定的東西,比如二進制文件中的損壞的符號哈希表,或者二進制文件和使用的動態鏈接器之間的不兼容性。 或者內存故障,磁盤故障,CPU緩存問題或其他硬件錯誤。

如果重新啟動讓它消失,我會非常懷疑硬件。 如果沒有,你可能在系統上有一些非常不穩定的東西,比如一些第三方解包安裝程序覆蓋了原始的C庫/動態鏈接器,這種奇怪。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM