我在 CentOS 上安装了 postgres 9.2.18,它使用标准安装路径。现在我意识到在这个特定的分区上,没有足够的硬盘空间来进行一些更大的查询。
默认的 data_directory 位于:
/var/lib/pgsql/data
$ df -h /var/lib/pgsql
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 50G 39G 12G 77% /
Run Code Online (Sandbox Code Playgroud)
所以,我想将数据目录移动到我的主存储库(它是一个仅供我自己使用的测试数据库)
$ df -h /home/mlu
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-home 395G 171G 224G 44% /home
Run Code Online (Sandbox Code Playgroud)
为此,我尝试过:
1) Copying postgres data using rsync:
sudo rsync -av /var/lib/pgsql /home/mlu/postgres-data
2) Addressing the new path within postgresql.conf:
sudo -u postgres nano /var/lib/pgsql/data/postgresql.conf
data_directory = '/home/mlu/postgres-data/pgsql/'
3) starting postgres:
sudo systemctl start postgresql
Run Code Online (Sandbox Code Playgroud)
由于 postgresql.conf …