简体   繁体   中英

How to set Postgres pg_wal as symbolic link

Using Postgres 13 on Ubuntu 21.10. I'm trying to move my pg_wal contents to a new disk, as the current one is full. I've moved the contents to a new disk, then created a symbolic link in the main postgres data directory. It shows up when listing the directory contents. However, trying to start postgresql results in "FATAL: required WAL directory "pg_wal" does not exist". It looks like Postgres isn't accepting the symbolic link as a folder, although the documentation specifies that is should work. Solutions?

output of "ls -la" in data dir:

...
drwx------  2 postgres uuidd    4096 Nov 16  2021 pg_twophase
lrwxrwxrwx  1 postgres postgres   17 Jun 28 13:09 pg_wal -> /data/pg_wal_move
drwx------  2 postgres uuidd    4096 Nov 16  2021 pg_xact
...

That will work just fine, as long as you shutdown the database while you move the WAL and create the symbolic link.

Of course, you have to make sure that the moved pg_wal still belongs to postgres , and that user postgres has "execute" permissions on all containing directories (in this case /data ). But a permission error should cause a different error message. Perhaps /data/pg_wal_move doesn't exist?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM