[英]openshift postgres persistent volume permissions
The postgres image I am currently deploying with openshift is generally working great. 我目前使用openshift部署的postgres映像通常运行良好。 However I need to persistently store the database data (of course) and to do so i created a persistent volume claim and mounted it to the postgres data directory like so:
但是,我需要永久存储数据库数据(当然),为此,我创建了一个永久卷声明,并将其安装到postgres数据目录中,如下所示:
- mountPath: /var/lib/pgsql/data/userdata
name: db-storage-volume
and 和
- name: db-storage-volume
persistentVolumeClaim:
claimName: db-storage
The problem I am facing now is that the initdb script wants to change the permission of that data folder, but it cant and the directory is assigned to a very weird user/group, as the output of ls -la /var/lib/pgsql/data
indicates (including the failing command output): 我现在面临的问题是initdb脚本想要更改该数据文件夹的权限,但是它不能,并且该目录已分配给一个非常奇怪的用户/组,如
ls -la /var/lib/pgsql/data
指示(包括失败的命令输出):
total 12
drwxrwxr-x. 3 postgres root 21 Aug 30 13:06 .
drwxrwx---. 3 postgres root 17 Apr 5 09:55 ..
drwxrwxrwx. 2 nobody nobody 12288 Jun 26 11:11 userdata
chmod: changing permissions of '/var/lib/pgsql/data/userdata': Permission denied
How can I handle this? 我该如何处理? I mean the permissions are enough to read/write but initdb (and the base images initialization functions) really want to change the permission of that folder.
我的意思是权限足以读取/写入,但是initdb(和基本映像初始化函数)确实想要更改该文件夹的权限。
Just as I had sent my question I had an idea and it turns out it worked: 正如我发送问题的时候,我有一个主意,事实证明它是有效的:
/var/lib/pgsql/data/
/var/lib/pgsql/data/
mkdir /var/lib/pgsql/data/userdata
when it runs first (aka the folder does not exist yet) mkdir /var/lib/pgsql/data/userdata
(又名该文件夹尚不存在) Now it is: 现在它是:
total 16
drwxrwxrwx. 3 nobody nobody 12288 Aug 30 13:19 .
drwxrwx---. 3 postgres root 17 Apr 5 09:55 ..
drwxr-xr-x. 2 1001320000 nobody 4096 Aug 30 13:19 userdata
Which works. 哪个有效。 Notice that the folder itself is still owned by
nobody:nobody
and is 777, but the created userdata
folder is owned by the correct user. 请注意,该文件夹本身仍由
nobody:nobody
拥有,为777,但是创建的userdata
文件夹由正确的用户拥有。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.