[root@ceph-admin ~]# ceph auth get client.admin -o client.admin.keyringexported keyring for client.admin[root@ceph-admin ~]# lsceph-deploy-ceph.logclient.admin.keyring[root@ceph-admin ~]# cat client.admin.keyring[client.admin]key = AQB94C1jTO8jJhAAY4Zhy40wduyIONnRqxtkEA==caps mds = "allow *"caps mgr = "allow *"caps mon = "allow *"caps osd = "allow *"[root@ceph-admin ~]# ceph auth export client.admin > client.admin.cluster.keyringexport auth(auid = 18446744073709551615 key=AQB94C1jTO8jJhAAY4Zhy40wduyIONnRqxtkEA== with 4 caps)[root@ceph-admin ~]# lsceph-deploy-ceph.logclient.admin.cluster.keyringclient.admin.keyring[root@ceph-admin ~]# cat client.admin.cluster.keyring[client.admin]key = AQB94C1jTO8jJhAAY4Zhy40wduyIONnRqxtkEA==caps mds = "allow *"caps mgr = "allow *"caps mon = "allow *"caps osd = "allow *"[root@ceph-admin ~]#添加用户命令格式:auth add <entity> {<caps> [<caps>...]}
[root@ceph-admin ~]# ceph auth add client.testuser mon 'allow r' osd 'allow rw'added key for client.testuser[root@ceph-admin ~]# ceph auth get client.testuserexported keyring for client.testuser[client.testuser]key = AQAoaThjCJLsBhAA8gwl/UQkjjSF+DwB6oB/wg==caps mon = "allow r"caps osd = "allow rw"[root@ceph-admin ~]#提示:ceph add 是添加用户的规范方法,它能够创建用户、生成密钥并添加指定的caps;这里需要注意我指定的用户是有type.id组成,一般普通用户都是client类型,后面的ID就是用户名称;
ceph auth get-or-create:简便方法,创建用户并返回密钥文件格式的密钥信息,或者在用户存在时返回用户名及密钥文件格式的密钥信息;
[root@ceph-admin ~]# ceph auth get-or-create client.testuser mon 'allow *' osd 'allow rw pool=rbdpool'Error EINVAL: key for client.testuser exists but cap mon does not match[root@ceph-admin ~]# ceph auth get-or-create client.testuser mon 'allow r' osd 'allow rw'[client.testuser]key = AQAoaThjCJLsBhAA8gwl/UQkjjSF+DwB6oB/wg==[root@ceph-admin ~]# ceph auth get-or-create client.tom mon 'allow *' osd 'allow rw pool=rbdpool'[client.tom]key = AQBcajhj8INfChAAKKFCESxmbHFJqAwiRE4ufg==[root@ceph-admin ~]#ceph auth get client.tomexported keyring for client.tom[client.tom]key = AQBcajhj8INfChAAKKFCESxmbHFJqAwiRE4ufg==caps mon = "allow *"caps osd = "allow rw pool=rbdpool"[root@ceph-admin ~]#提示:使用ceph auth get-or-create命令添加用户,如果用户存在,但授权不匹配,它会提示我们用户存在,但是权限不匹配;如果用户存在,权限信息也都匹配,则返回对应用户的key;如果用户不存在 , 则创建对应用并返回用户的key;
ceph auth get-or-create-key:简便方法 , 创建用户并返回密钥信息,或者在用户存在时返回密钥信息;
[root@ceph-admin ~]# ceph auth get-or-create-key client.testuser mon 'allow r' osd 'allow *'Error EINVAL: key for client.testuser exists but cap osd does not match[root@ceph-admin ~]# ceph auth get-or-create-key client.testuser mon 'allow r' osd 'allow rw'AQAoaThjCJLsBhAA8gwl/UQkjjSF+DwB6oB/wg==[root@ceph-admin ~]# ceph auth get-or-create-key client.jerry mon 'allow r' osd 'allow rw'AQDDazhjLbMTIhAADsXyBkPS079vU7dqGs2E+A==[root@ceph-admin ~]# ceph auth get client.jerryexported keyring for client.jerry[client.jerry]key = AQDDazhjLbMTIhAADsXyBkPS079vU7dqGs2E+A==caps mon = "allow r"caps osd = "allow rw"[root@ceph-admin ~]#提示:该命令和上面的get-or-create类似,都是用户存在,如果权限匹配则返回对应用户的key,如果不匹配则告诉我们用户存在,但权限不匹配;如果不存在则创建 , 并返回对应用户的key;不同的是返回key的格式不同;get-or-create是返回keyring文件中的格式;而get-or-create-key则返回key的值,没有key = ;
注意:典型的用户至少对 Ceph monitor 具有读取功能,并对 Ceph OSD 具有读取和写入功能;另外,用户的 OSD 权限通常应该限制为只能访问特定的存储池,否则 , 他将具有访问集群中所有存储池的权限;
列出用户的密钥格式 命令:ceph auth print-key TYPE.ID
[root@ceph-admin ~]# ceph auth print-key client.jerryAQDDazhjLbMTIhAADsXyBkPS079vU7dqGs2E+A==[root@ceph-admin ~]#导入用户命令:ceph auth import
[root@ceph-admin ~]# lltotal 16-rw-r--r-- 1 root root 1568 Sep 25 11:40 ceph-deploy-ceph.log-rw-r--r-- 1 root root151 Oct2 00:14 client.admin.cluster.keyring-rw-r--r-- 1 root root151 Oct2 00:14 client.admin.keyring-rw-r--r-- 1 root root164 Oct2 00:43 client.test.keyring[root@ceph-admin ~]# cat client.test.keyring[client.test]key = AQB94C1jTO8jJhAAY4Zhy40wduyIONnRqxtkEA==caps mds = "allow *"caps mgr = "allow *"caps mon = "allow r"caps osd = "allow rw pool=rbdpool"[root@ceph-admin ~]# ceph auth get client.testError ENOENT: failed to find client.test in keyring[root@ceph-admin ~]# ceph auth import -i client.test.keyringimported keyring[root@ceph-admin ~]# ceph auth get client.testexported keyring for client.test[client.test]key = AQB94C1jTO8jJhAAY4Zhy40wduyIONnRqxtkEA==caps mds = "allow *"caps mgr = "allow *"caps mon = "allow r"caps osd = "allow rw pool=rbdpool"[root@ceph-admin ~]#
推荐阅读
- 分布式存储系统之Ceph集群存储池操作
- 阴阳师剧情收录系统有什么功能
- 分布式存储系统之Ceph集群存储池、PG 与 CRUSH
- 苹果ios14.7新功能_苹果ios14.7系统怎么样
- centos7系统资源限制整理
- 引擎之旅 Chapter.4 日志系统
- 分布式存储系统之Ceph集群状态获取及ceph配置文件说明
- 分布式存储系统之Ceph集群访问接口启用
- 分布式存储系统之Ceph集群部署
- ERP 系统的核心是什么?有什么作用?