[英]could not open file "./.postgresql.conf.swp": Permission denied
i am getting permission denied error while taking backup using pg_basebackup.使用 pg_basebackup 进行备份时出现权限被拒绝错误。
/usr/pgsql-11/bin/pg_basebackup -h127.0.0.1 -U thbbackup -D backup -Ft -z -P
Password:
238546/238575 kB (99%), 1/1 tablespace
pg_basebackup: could not get write-ahead log end position from server: ERROR: could not open file "./.postgresql.conf.swp": Permission denied
pg_basebackup: removing data directory "backup"
You have probably forgotten the file postgresql.conf open in a text editor (vim).您可能忘记了在文本编辑器 (vim) 中打开的 postgresql.conf 文件。 If you open this conf file again then the text editor should complain saying it is already open so, you can just delete this as .swp file it is a temporary file anyway.
如果你再次打开这个 conf 文件,那么文本编辑器应该会抱怨它已经打开,所以你可以将它作为 .swp 文件删除,它无论如何都是一个临时文件。
"When you edit a file in Vim, you have probably noticed the (temporary) .swp file that gets created. By default it'll be in the same location as the file that you are editing (although you can change this). The swap file contains the info about changes made to the file (or buffer)." “当您在 Vim 中编辑文件时,您可能已经注意到创建的(临时).swp 文件。默认情况下,它与您正在编辑的文件位于同一位置(尽管您可以更改此位置)。交换文件包含有关对文件(或缓冲区)所做更改的信息。”
In this case it looks like a swap file from an open editor or previously orphaned.在这种情况下,它看起来像是来自打开的编辑器或以前孤立的交换文件。 In general, Postgres needs ownership of all files in the data directory for a pg_basebackup.
通常,Postgres 需要对 pg_basebackup 的数据目录中的所有文件拥有所有权。 I have seen this failure on files with
root:root
or other ownership residing in the data directory.我在数据目录中具有
root:root
或其他所有权的文件上看到了这种失败。 After running chown postgres:postgres [filename]
on the target files, pg_basebackup should be able to run successfully.在目标文件上运行
chown postgres:postgres [filename]
后,pg_basebackup 应该能够成功运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.