运行此命令:
oc rsync local/path/to/mongodump <mongodb_pod_name>:/var/lib/mongodb/data
得到了这个输出:
sent 31,825,902 bytes received 273 bytes 1,720,333.78 bytes/sec
total size is 31,817,949 speedup is 1.00
rsync: failed to set permissions on "/var/lib/mongodb/data/." (in root):
Operation not permitted (1)
rsync: failed to modify permissions on "/var/lib/mongodb/data/." (in root):
Operation not permitted (1)
rsync error: some files/attrs were not transferred (see previous errors)
(code 23) at main.c(1165) [sender=3.1.1]
error: exit status 23
当我尝试运行时
$ oc rsh <mongodb_pod>
$ cd /var/lib/mongodb/data/mongodump
我被许可拒绝
答案 0 :(得分:0)
尝试:
oc rsync --no-perms
请参阅以下示例教程:将文件传入和传出容器:
它提到某些情况需要该选项。
由于它是一个转储文件,我假设您将加载到mongodb,最好将其复制到/tmp
然后从那里加载mongodb。然后你就不需要在完成后删除它,因为重启容器会看到/tmp
中的文件被丢弃。