[英]Postgresql 9.6 initdb fails in Centos 7 docker container
[英]Postgresql 9.6 InitDB Fails
每當我嘗試運行下面的命令時,它總是在 RHEL7 上失敗。 我已經嘗試過另一個類似的操作系統(較新),但它沒有這樣做,只是可以工作。
我查看了目錄的權限,禁用了 selinux(以防萬一)並查看了語言環境,但是這些設置與我的其他服務器的設置相匹配。
/usr/pgsql-9.6/bin/postgresql96-setup initdb
日志輸出:
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.
fixing permissions on existing directory /var/lib/pgsql/9.6/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 64MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... < 2017-10-23 20:13:54.035 BST > LOG: invalid value for parameter "lc_messages": "en_US.UTF-8"
< 2017-10-23 20:13:54.035 BST > LOG: invalid value for parameter "lc_monetary": "en_US.UTF-8"
< 2017-10-23 20:13:54.035 BST > LOG: invalid value for parameter "lc_numeric": "en_US.UTF-8"
< 2017-10-23 20:13:54.035 BST > LOG: invalid value for parameter "lc_time": "en_US.UTF-8"
< 2017-10-23 20:13:54.035 BST > FATAL: configuration file "/var/lib/pgsql/9.6/data/postgresql.conf" contains errors
child process exited with exit code 1
initdb: removing contents of data directory "/var/lib/pgsql/9.6/data"
系統似乎無法將en_US.UTF-8
語言環境識別為有效。
您是否應用了任何步驟來最小化已安裝的語言環境集? 您的/usr/lib/locale/locale-archive
文件的大小是多少? 它應該在 100 MiB 左右。 您也可以將其與全新安裝進行比較,以確保( rpm -V
不適用於此文件)。
當運行 Windows 10 安裝程序並選擇美國英語作為我的語言環境時,我看到參數是English_United States.1252
,即:
lc_messages = 'English_United States.1252'
lc_monetary = 'English_United States.1252'
lc_numeric = 'English_United States.1252'
lc_time = 'English_United States.1252'
對我來說,我的 initdb 也失敗了,因為我選擇了default
語言環境選項,它只是一個空字符串。 但是,選擇此選項時,DB已啟動。 我不知道這是否解決了您的特定問題,但也許它可以幫助其他人!
我遇到過這個問題,它似乎是由缺少語言環境引起的。 我的 Postgres 配置文件使用的是en_GB.utf8
。
通過安裝語言環境修復:
localedef -i en_GB -c -f UTF-8 -A /usr/share/locale/locale.alias en_GB.UTF-8
並將LANG
環境變量設置為en_GB.utf8
。
我在Postgres Docker 映像文檔(“區域設置自定義”部分)中找到了修復程序。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.