directory "*" exists but is not empty

在使用pg_basebackup备份基础数据的时候,遇到了错误

directory "/home/Thornger" exists but is not empty

经过检查-D ‘/home/Thornger/data2’,指定的文件夹里面确实是空的。

[Thornger@localhost postgres-9.6]$ ll data2/
total 0

data2 下没有数据,这时候你就应该检查你的主库,也就是说你指定创建基础备份的库。检查一下有没有特殊地方的tablespace

psql
postgres=# \db
          List of tablespaces
    Name    |  Owner   |    Location    
------------+----------+----------------
 pg_default | Thornger | 
 pg_global  | Thornger | 
 test       | Thornger | /home/Thornger

问题找到了,有一个自建的tablespace 在/home/Thornger下。
pg_basebackup 中有一个参数:大概意思就是将你以前创建的tablespace目录对应到现在指定的tablespace 目录。

-T olddir=newdir
--tablespace-mapping=olddir=newdir
Relocate the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is currently defined. (But it is not an error if there is no tablespace in olddir contained in the backup.) Both olddir and newdir must be absolute paths. If a path happens to contain a = sign, escape it with a backslash. This option can be specified multiple times for multiple tablespaces. See examples below.

If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations.

所以:参数中指定

 -T /home/Thornger=/home/Thornger/data2/

问题解决

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值