共享儲存上的 PostgreSQL 和資料庫叢集所有權

共享儲存上的 PostgreSQL 和資料庫叢集所有權

在我的研究中,我使用始終在線的虛擬機器來對資料進行主要分析。為此,我需要(或者,我想,願意)建立資料並將其儲存在 PostgreSQL 資料庫中。 VM 運行 CentOS 7,我的登入名稱(我們稱之為「username」)具有 root 存取權限。問題:

資料必須儲存在 location 中安裝的共用儲存上/shared/username/data。我(' username')是目錄和所有子目錄的所有者/shared/username/,並且(出於安全原因?)似乎無法通過chown或進行更改sudo chown。這意味著我無法以用戶身份啟動資料庫postgres,因為它需要/shared/username/data.見下文。

登入為postgres

bash-4.2$ /usr/pgsql-9.4/bin/initdb -D /shared/username/data
could not change directory to "/shared/username": Permission denied
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.

initdb: could not access directory "/shared/username/data": Permission denied

我是 PostgreSQL 的新手,但已經使用各種形式的 Linux 一段時間了。儘管檔案權限有時讓我感到困惑。

這個問題有可能的解決方案嗎?也許以某種方式阻止 initdb 撤銷 的存取權限username?感謝任何幫助,我很樂意提供任何其他資訊。

相關內容