一、Ceph的配置文件

Ceph 配置文件可用于配置存储集群内的所有守护进程、或者某一类型的所有守护进程。要配置一系列守护进程,这些配置必须位于能收到配置的段落之下。默认情况下,无论是ceph的服务端还是客户端,配置文件都存储在/etc/ceph/ceph.conf文件中

如果修改了配置参数,必须使用/etc/ceph/ceph.conf文件在所有节点(包括客户端)上保持一致。

ceph.conf 采用基于 INI 的文件格式,包含具有 Ceph 守护进程和客户端相关配置的多个部分。每个部分具有一个使用 [name] 标头定义的名称,以及键值对的一个或多个参数

[root@ceph2 ceph]# cat ceph.conf

  1. [global] #存储所有守护进程之间通用配置。它应用到读取配置文件的所有进程,包括客户端。配置影响 Ceph 集群里的所有守护进程。
  2. fsid = 35a91e48--4e96-a7ee-980ab989d20d #这个ID和ceph -s查看的ID是一个
  3. mon initial members = ceph2,ceph3,ceph4 #monitor的初始化配置,定义ceph最初安装的时候定义的monitor节点,必须在启动的时候就准备就绪的monitor节点。
  4. mon host = 172.25.250.11,172.25.250.12,172.25.250.13
  5. public network = 172.25.250.0/
  6. cluster network = 172.25.250.0/
  7. [osd] #配置影响存储集群里的所有 ceph-osd 进程,并且会覆盖 [global] 下的同一选项
  8. osd mkfs type = xfs
  9. osd mkfs options xfs = -f -i size=
  10. osd mount options xfs = noatime,largeio,inode64,swalloc
  11. osd journal size =

注:配置文件使用#和;来注释,参数名称可以使用空格、下划线、中横线来作为分隔符。如osd journal size 、 osd_jounrnal_size 、 osd-journal-size是有效且等同的参数名称

1.1 osd介绍

一个裸磁盘给ceph后,会被格式化成xfs格式,并且会分两个分区,一个数据区和一个日志区

[root@ceph2 ceph]# fdisk -l

OSD的id和磁盘对应关系

[root@ceph2 ceph]# df -hT

Ceph的配置文件位置和工作目录分别为:/etc/ceph和 cd /var/lib/ceph/

[root@ceph2 ceph]# ceph osd tree

二、删除一个存储池

2.1 修改配置文件

先配置一个参数为mon_allow_pool_delete为true

  1. [root@ceph1 ceph-ansible]# vim /etc/ceph/ceph.conf
  2. [global]
  3. fsid = 35a91e48--4e96-a7ee-980ab989d20d
  4. mon initial members = ceph2,ceph3,ceph4
  5. mon host = 172.25.250.11,172.25.250.12,172.25.250.13
  6. public network = 172.25.250.0/
  7. cluster network = 172.25.250.0/
  8. [osd]
  9. osd mkfs type = xfs
  10. osd mkfs options xfs = -f -i size=
  11. osd mount options xfs = noatime,largeio,inode64,swalloc
  12. osd journal size =
  13. [mon] #添加配置
  14. mon_allow_pool_delete = true

2.2 同步各个节点

[root@ceph1 ceph-ansible]# ansible all -m copy -a 'src=/etc/ceph/ceph.conf dest=/etc/ceph/ceph.conf owner=ceph group=ceph mode=0644'

  1. ceph3 | SUCCESS => {
  2. "changed": true,
  3. "checksum": "18ad6b3743d303bdd07b8655be547de35f9b4e55",
  4. "dest": "/etc/ceph/ceph.conf",
  5. "failed": false,
  6. "gid": ,
  7. "group": "ceph",
  8. "md5sum": "8415ae9d959d31fdeb23b06ea7f61b1b",
  9. "mode": "",
  10. "owner": "ceph",
  11. "size": ,
  12. "src": "/root/.ansible/tmp/ansible-tmp-1552807199.08-216306208753591/source",
  13. "state": "file",
  14. "uid":
  15. }
  16. ceph4 | SUCCESS => {
  17. "changed": true,
  18. "checksum": "18ad6b3743d303bdd07b8655be547de35f9b4e55",
  19. "dest": "/etc/ceph/ceph.conf",
  20. "failed": false,
  21. "gid": ,
  22. "group": "ceph",
  23. "md5sum": "8415ae9d959d31fdeb23b06ea7f61b1b",
  24. "mode": "",
  25. "owner": "ceph",
  26. "size": ,
  27. "src": "/root/.ansible/tmp/ansible-tmp-1552807199.09-46038387604349/source",
  28. "state": "file",
  29. "uid":
  30. }
  31. ceph2 | SUCCESS => {
  32. "changed": true,
  33. "checksum": "18ad6b3743d303bdd07b8655be547de35f9b4e55",
  34. "dest": "/etc/ceph/ceph.conf",
  35. "failed": false,
  36. "gid": ,
  37. "group": "ceph",
  38. "md5sum": "8415ae9d959d31fdeb23b06ea7f61b1b",
  39. "mode": "",
  40. "owner": "ceph",
  41. "size": ,
  42. "src": "/root/.ansible/tmp/ansible-tmp-1552807199.04-33302205115898/source",
  43. "state": "file",
  44. "uid":
  45. }
  46. ceph1 | SUCCESS => {
  47. "changed": false,
  48. "checksum": "18ad6b3743d303bdd07b8655be547de35f9b4e55",
  49. "failed": false,
  50. "gid": ,
  51. "group": "ceph",
  52. "mode": "",
  53. "owner": "ceph",
  54. "path": "/etc/ceph/ceph.conf",
  55. "size": ,
  56. "state": "file",
  57. "uid":
  58. }

输出结果

或者配置此选项

[root@ceph1 ceph-ansible]# vim /usr/share/ceph-ansible/group_vars/all.yml

重新执行palybook
[root@ceph1 ceph-ansible]# ansible-playbook site.yml

配置文件修改后不会立即生效,要重启相关的进程,比如所有的osd,或所有的monitor

[root@ceph2 ceph]#  cat /etc/ceph/ceph.conf

同步成功

2.3 每个节点重启服务

[root@ceph2 ceph]# systemctl restart ceph-mon@serverc

或者

[root@ceph2 ceph]# systemctl restart ceph-mon.target

也可以使用ansible同时启动

  1. [root@ceph1 ceph-ansible]# ansible mons -m shell -a ' systemctl restart ceph-mon.target' #这种操作坚决不允许在生产环境操作
  2. ceph2 | SUCCESS | rc= >>
  3. ceph4 | SUCCESS | rc= >>
  4. ceph3 | SUCCESS | rc= >>

2.4 删除池

  1. [root@ceph2 ceph]# ceph osd pool ls
  2. testpool
  3. EC-pool
  4. [root@ceph2 ceph]# ceph osd pool delete EC-pool EC-pool --yes-i-really-really-mean-it
  5. pool 'EC-pool' removed
  6. [root@ceph2 ceph]# ceph osd pool ls
  7. testpool

三、修改配置文件

3.1  临时修改一个配置文件

  1. [root@ceph2 ceph]# ceph tell mon.* injectargs '--mon_osd_nearfull_ratio 0.85' #在输出信息显示需要重启服务,但是配置已经生效
  2. mon.ceph2: injectargs:mon_osd_nearfull_ratio = '0.850000' (not observed, change may require restart)
  3. mon.ceph3: injectargs:mon_osd_nearfull_ratio = '0.850000' (not observed, change may require restart)
  4. mon.ceph4: injectargs:mon_osd_nearfull_ratio = '0.850000' (not observed, change may require restart)
  5. [root@ceph2 ceph]# ceph tell mon.* injectargs '--mon_osd_full_ratio 0.95'
  6. mon.ceph2: injectargs:mon_osd_full_ratio = '0.950000' (not observed, change may require restart)
  7. mon.ceph3: injectargs:mon_osd_full_ratio = '0.950000' (not observed, change may require restart)
  8. mon.ceph4: injectargs:mon_osd_full_ratio = '0.950000' (not observed, change may require restart)
  9. [root@ceph2 ceph]# ceph daemon osd. config show|grep nearfull
  10. "mon_osd_nearfull_ratio": "0.850000",
  11. [root@ceph2 ceph]# ceph daemon mon.ceph2 config show|grep mon_osd_full_ratio
  12. "mon_osd_full_ratio": "0.950000",

3.2 元变量介绍

所谓元变量是即Ceph内置的变量。可以用它来简化ceph.conf文件的配置:

$cluster:Ceph存储集群的名称。默认为ceph,在/etc/sysconfig/ceph文件中定义。例如,log_file参数的默认值是/var/log/ceph/$cluster-$name.log。在扩展之后,它变为/var/log/ceph/ceph-mon.ceph-node1.log

$type:守护进程类型。监控器使用mon;OSD使用osd,元数据服务器使用mds,管理器使用mgr,客户端应用使用client。如在[global]部分中将pid_file参数设定义为/var/run/$cluster/$type.$id.pid,它会扩展为/var/run/ceph/osd.0.pid,表示ID为0的 OSD。对于在ceph-node1上运行的MON守护进程,它扩展为/var/run/ceph/mon.ceph-node1.pid

$id:守护进程实例ID。对于ceph-node1上的MON,设置为ceph-node1。对于osd.1,它设置为1。如果是客户端应用,这是用户名

$name:守护进程名称和实例ID。这是$type.$id的快捷方式

$host:其上运行了守护进程的主机的名称

补充:

关闭所有ceph进程

[root@ceph2 ceph]# ps -ef|grep "ceph-"|grep -v grep|awk '{print $2}'|xargs kill -9

3.3 组件之间启用cephx认证配置

[root@ceph2 ceph]# ceph daemon osd.3 config show|grep grace

[root@ceph2 ceph]# ceph daemon mon.ceph2 config show|grep auth

修改配置文件

[root@ceph1 ceph-ansible]#  vim /etc/ceph/ceph.conf

  1. auth_cluster_required = cephx
  2. auth_service_required = cephx
  3. auth_client_required = cephx

[root@ceph1 ceph-ansible]# ansible all -m copy -a 'src=/etc/ceph/ceph.conf dest=/etc/ceph/ceph.conf owner=ceph group=ceph mode=0644'

[root@ceph1 ceph-ansible]# ansible mons -m shell -a ' systemctl restart ceph-mon.target'

[root@ceph1 ceph-ansible]# ansible mons -m shell -a ' systemctl restart ceph-osd.target'

[root@ceph1 ceph-ansible]# ansible mons -m shell -a ' systemctl restart ceph-mgr.target'

[root@ceph2 ceph]# ceph daemon mon.ceph2 config show|grep auth

cephx验证

四、Ceph用户管理

用户管理需要用户名和秘钥

[root@ceph2 ceph]# cat ceph.client.admin.keyring

  1. [client.admin]
  2. key = AQD7fYxcnG+wCRAARyLuAewyDcGmTPb5wdNRvQ==
  3. caps mds = "allow *"
  4. caps mgr = "allow *"
  5. caps mon = "allow *"
  6. caps osd = "allow *"

假如没有秘钥环,在执行ceph -s等相关操作就会报错,如在ceph1执行

[root@ceph1 ceph-ansible]# ceph -s

  1. -- ::31.824428 7fc87b255700 - auth: unable to find a keyring on /etc/ceph/ceph.client.admin.keyring,/etc/ceph/ceph.keyring,/etc/ceph/keyring,/etc/ceph/keyring.bin,: () No such file or directory
  2. -- ::31.824437 7fc87b255700 - monclient: ERROR: missing keyring, cannot use cephx for authentication
  3. -- ::31.824439 7fc87b255700 librados: client.admin initialization error () No such file or directory
  4. [errno ] error connecting to the cluster

4.1 Ceph授权

Ceph把数据以对象的形式存于个存储池中,Ceph用户必须具有访问存储池的权限能够读写数据

Ceph用caps来描述给用户的授权,这样才能使用Mon,OSD和MDS的功能

caps也用于限制对某一存储池内的数据或某个命名空间的访问

Ceph管理用户可在创建或更新普通用户是赋予其相应的caps

Ceph常用权限说明:

r:赋予用户读数据的权限,如果我们需要访问集群的任何信息,都需要先具有monitor的读权限

w:赋予用户写数据的权限,如果需要在osd上存储或修改数据就需要为OSD授予写权限

x:赋予用户调用对象方法的权限,包括读和写,以及在monitor上执行用户身份验证的权限

class-read:x的子集,允许用户调用类的read方法,通常用于rbd类型的池

class-write:x的子集,允许用户调用类的write方法,通常用于rbd类型的池

*:将一个指定存储池的完整权限(r、w和x)以及执行管理命令的权限授予用户

profile osd:授权一个用户以OSD身份连接其它OSD或者Monitor,用于OSD心跳和状态报告

profile mds:授权一个用户以MDS身份连接其他MDS或者Monitor

profile bootstrap-osd:允许用户引导OSD。比如ceph-deploy和ceph-disk工具都使用client.bootstrap-osd用户,该用户有权给OSD添加密钥和启动加载程序

profile bootstrap-mds:允许用户引导MDS。比如ceph-deploy工具使用了client.bootstrap-mds用户,该用户有权给MDS添加密钥和启动加载程序

4.2 添加用户

  1. [root@ceph2 ceph]# ceph auth add client.ning mon 'allow r' osd 'allow rw pool=testpool' #当用户不存在,则创建用户并授权;当用户存在,当权限不变,则不进行任何输出;当用户存在,不支持修改权限
  2. added key for client.ning
  3. [root@ceph2 ceph]# ceph auth add client.ning mon 'allow r' osd 'allow rw'
  4. Error EINVAL: entity client.ning exists but cap osd does not match
  5. [root@ceph2 ceph]# ceph auth get-or-create client.joy mon 'allow r' osd 'allow rw pool=mytestpool' #当用户不存在,则创建用户并授权并返回用户和key,当用户存在,权限不变,返回用户和key,,当用户存在,权限修改,则返回报错
  6. [client.joy]
  7. key = AQBiBY5cJ2gBLBAA/ZCGDdp6JWkPuuU0YaLsrw==
  8. [root@ceph2 ceph]# cat ceph.client.admin.keyring
  9. [client.admin]
  10. key = AQD7fYxcnG+wCRAARyLuAewyDcGmTPb5wdNRvQ==
  11. caps mds = "allow *"
  12. caps mgr = "allow *"
  13. caps mon = "allow *"
  14. caps osd = "allow *"
  15. [root@ceph2 ceph]# ceph auth get-or-create client.joy mon 'allow r' osd 'allow rw' #当用户不存在,则创建用户并授权只返回key;当用户存在,权限不变,只返回key;当用户存在,权限修改,则返回报错
  16. Error EINVAL: key for client.joy exists but cap osd does not match

4.3 删除用户

  1. [root@ceph2 ceph]# ceph auth get-or-create client.xxx #创建一个xxx用户
  2. [client.xxx]
  3. key = AQAOB45c4KIoCRAAF/kDd7r4uUjKEdEHOSP8Xw==
  4. [root@ceph2 ceph]# ceph auth del client.xxx #删除xxx用户
  5. updated
  6. [root@ceph2 ceph]# ceph auth get client.xxx #用户已经删除
  7. Error ENOENT: failed to find client.xxx in keyring
  8. [root@ceph2 ceph]# ceph auth get client.ning
  9. exported keyring for client.ning
  10. [client.ning]
  11. key = AQAcBY5coY/rLxAAvq99xcSOrwLI1ip0WAw2Sw==
  12. caps mon = "allow r"
  13. caps osd = "allow rw pool=testpool"
  14. [root@ceph2 ceph]# ceph auth get-key client.ning
  15. AQAcBY5coY/rLxAAvq99xcSOrwLI1ip0WAw2Sw==[root@ceph2 ceph]#

4.4 导出用户

  1. [root@ceph2 ceph]# ceph auth get-or-create client.ning -o ./ceph.client.ning.keyring
  2. [root@ceph2 ceph]# ll ./ceph.client.ning.keyring
  3. -rw-r--r-- root root Mar : ./ceph.client.ning.keyring
  4. [root@ceph2 ceph]# cat ./ceph.client.ning.keyring
  5. [client.ning]
  6. key = AQAcBY5coY/rLxAAvq99xcSOrwLI1ip0WAw2Sw==

ceph1上验证验证操作

  1. [root@ceph2 ceph]# scp ./ceph.client.ning.keyring 172.25.250.10:/etc/ceph/ 把秘钥传给cph1
  2. [root@ceph1 ceph-ansible]# ceph -s #发现没有成功,需要制定ID或用户
  3. -- ::01.936939 7fbad2aae700 - auth: unable to find a keyring on /etc/ceph/ceph.client.admin.keyring,/etc/ceph/ceph.keyring,/etc/ceph/keyring,/etc/ceph/keyring.bin,: () No such file or directory
  4. -- ::01.936950 7fbad2aae700 - monclient: ERROR: missing keyring, cannot use cephx for authentication
  5. -- ::01.936951 7fbad2aae700 librados: client.admin initialization error () No such file or directory
  6. [errno ] error connecting to the cluster
  7. [root@ceph1 ceph-ansible]# ceph -s --name client.ning #指定用户查看
  8. cluster:
  9. id: 35a91e48--4e96-a7ee-980ab989d20d
  10. health: HEALTH_OK
  11. services:
  12. mon: daemons, quorum ceph2,ceph3,ceph4
  13. mgr: ceph4(active), standbys: ceph2, ceph3
  14. osd: osds: up, in
  15. data:
  16. pools: pools, pgs
  17. objects: objects, bytes
  18. usage: MB used, GB / GB avail
  19. pgs: active+clean
  20. [root@ceph1 ceph-ansible]# ceph osd pool ls --name client.ning
  21. testpool
  22. [root@ceph1 ceph-ansible]# ceph osd pool ls --id ning
  23. testpool
  24. [root@ceph1 ceph-ansible]#
  25. [root@ceph1 ceph-ansible]# rados -p testpool ls --id ning
  26. test2
  27. test
  28. [root@ceph1 ceph-ansible]# rados -p testpool put aaa /etc/ceph/ceph.conf --id ning #验证数据的上传下载
  29. [root@ceph1 ceph-ansible]# rados -p testpool ls --id ning
  30. test2
  31. aaa
  32. test
  33. [root@ceph1 ceph-ansible]# rados -p testpool get aaa /root/aaa.conf --name client.ning
  34. [root@ceph1 ceph-ansible]# diff /root/aaa.conf /etc/ceph/ceph.conf

4.5 导入用户

  1. [root@ceph2 ceph]# ceph auth export client.ning -o /etc/ceph/ceph.client.ning-.keyring
  2. export auth(auid = key=AQAcBY5coY/rLxAAvq99xcSOrwLI1ip0WAw2Sw== with caps)
  3. [root@ceph2 ceph]# ll
  4. total
  5. -rw------- ceph ceph Mar : ceph.client.admin.keyring
  6. -rw-r--r-- root root Mar : ceph.client.ning-.keyring
  7. -rw-r--r-- root root Mar : ceph.client.ning.keyring
  8. -rw-r--r-- ceph ceph Mar : ceph.conf
  9. drwxr-xr-x ceph ceph Mar : ceph.d
  10. -rw-r--r-- root root Nov rbdmap
  11. [root@ceph2 ceph]# cat ceph.client.ning-.keyring #带有授权信息
  12. [client.ning]
  13. key = AQAcBY5coY/rLxAAvq99xcSOrwLI1ip0WAw2Sw==
  14. caps mon = "allow r"
  15. caps osd = "allow rw pool=testpool"
  16. [root@ceph2 ceph]# ceph auth get client.ning
  17. exported keyring for client.ning
  18. [client.ning]
  19. key = AQAcBY5coY/rLxAAvq99xcSOrwLI1ip0WAw2Sw==
  20. caps mon = "allow r"
  21. caps osd = "allow rw pool=testpool"

4.6 用户被删除,恢复用户

  1. [root@ceph2 ceph]# cat ceph.client.ning.keyring #秘钥环没有权限信息
  2. [client.ning]
  3. key = AQAcBY5coY/rLxAAvq99xcSOrwLI1ip0WAw2Sw==
  4. [root@ceph2 ceph]# ceph auth del client.ning #删除这个用户
  5. updated
  6. [root@ceph1 ceph-ansible]# ll /etc/ceph/ceph.client.ning.keyring #在客户端,秘钥环依然存在
  7. -rw-r--r-- root root Mar : /etc/ceph/ceph.client.ning.keyring
  8. [root@ceph1 ceph-ansible]# ceph -s --name client.ning #秘钥环的用户被删除,无效
  9. -- ::13.896609 7f841eb27700 librados: client.ning authentication error () Operation not permitted
  10. [errno ] error connecting to the cluster
  11. [root@ceph2 ceph]# ceph auth import -i ./ceph.client.ning-.keyring #使用ning-.keyring恢复
  12. imported keyring
  13. [root@ceph2 ceph]# ceph auth list |grep ning #用户恢复
  14. installed auth entries:
  15. client.ning
  16. [root@ceph1 ceph-ansible]# ceph osd pool ls --name client.ning #客户端验证,秘钥生效
  17. testpool
  18. EC-pool

4.7 修改用户权限

两种方法,一种是直接删除这个用户,重新创建具有新权限的用户,但是会导致使用这个用户连接的客户端,都将全部失效。可以使用下面的方法修改

ceph auth caps 用户修改用户授权。如果给定的用户不存在,直接返回报错。如果用户存在,则使用新指定的权限覆盖现有权限。所以,如果只是给用户新增权限,则原来的权限需要原封不动的带上。如果需要删除原来的权限,只需要将该权限设定为空即可。

  1. [root@ceph2 ceph]# ceph auth get client.joy #查看用户权限
  2. exported keyring for client.joy
  3. [client.joy]
  4. key = AQBiBY5cJ2gBLBAA/ZCGDdp6JWkPuuU0YaLsrw==
  5. caps mon = "allow r"
  6. caps osd = "allow rw pool=mytestpool"
  7. [root@ceph2 ceph]# ceph osd pool ls
  8. testpool
  9. EC-pool
  10. [root@ceph2 ceph]# ceph auth caps client.joy mon 'allow r' osd 'allow rw pool=mytestpool,allow rw pool=testpool' #对用户joy添加对testpool这个池的权限
  11. updated caps for client.joy
  12. [root@ceph2 ceph]# ceph auth get client.joy #查看成功添加
  13. exported keyring for client.joy
  14. [client.joy]
  15. key = AQBiBY5cJ2gBLBAA/ZCGDdp6JWkPuuU0YaLsrw==
  16. caps mon = "allow r"
  17. caps osd = "allow rw pool=mytestpool,allow rw pool=testpool"
  18. [root@ceph2 ceph]# rados -p testpool put joy /etc/ceph/ceph.client.admin.keyring --id joy #但是没有秘钥,需要导出秘钥
  19. -- ::36.602310 7ff35e71ee40 - auth: unable to find a keyring on /etc/ceph/ceph.client.joy.keyring,/etc/ceph/ceph.keyring,/etc/ceph/keyring,/etc/ceph/keyring.bin,: () No such file or directory
  20. -- ::36.602337 7ff35e71ee40 - monclient: ERROR: missing keyring, cannot use cephx for authentication
  21. -- ::36.602340 7ff35e71ee40 librados: client.joy initialization error () No such file or directory
  22. couldn't connect to cluster: (2) No such file or directory
  23. [root@ceph2 ceph]# ceph auth get-or-create client.joy -o /etc/ceph/ceph.client.joy.keyring #导出秘钥
  24. [root@ceph2 ceph]# rados -p testpool put joy /etc/ceph/ceph.client.admin.keyring --id joy #上传数据测试测试
  25. [root@ceph2 ceph]# rados -p testpool ls --id joy #测试成功,用户权限修改成功
  26. joy
  27. test2
  28. aaa
  29. test
  30. [root@ceph2 ceph]# ceph auth caps client.joy mon 'allow r' osd 'allow rw pool=testpool' #去掉对mytestpool的权限
  31. updated caps for client.joy
  32. [root@ceph2 ceph]# ceph auth get client.joy #修改成功
  33. exported keyring for client.joy
  34. [client.joy]
  35. key = AQBiBY5cJ2gBLBAA/ZCGDdp6JWkPuuU0YaLsrw==
  36. caps mon = "allow r"
  37. caps osd = "allow rw pool=testpool"
  38. [root@ceph2 ceph]# ceph auth caps client.ning mon '' osd '' #清除掉所有权限,但是必须保留对mon的读权限
  39. Error EINVAL: moncap parse failed, stopped at end of ''
  40. [root@ceph2 ceph]# ceph auth caps client.ning mon 'allow r' osd '' #成功清除所有权限,但是还有mon的权限
  41. updated caps for client.ning
  42. [root@ceph2 ceph]# ceph auth get client.ning
  43. exported keyring for client.ning
  44. [client.ning]
  45. key = AQAcBY5coY/rLxAAvq99xcSOrwLI1ip0WAw2Sw==
  46. caps mon = "allow r"
  47. caps osd = ""
  48. [root@ceph2 ceph]# ceph auth get-or-create joyning #即也不可以创建空权限用户,既没有monitor读权限的用户
  49. Error EINVAL: bad entity name

4.8 推送用户

创建的用户主要用于客户端授权,所以需要将创建的用户推送至客户端。如果需要向同一个客户端推送多个用户,可以将多个用户的信息写入同一个文件,然后直接推送该文件

  1. [root@ceph2 ceph]# ceph-authtool -C /etc/ceph/ceph.keyring #创建一个秘钥文件
  2. creating /etc/ceph/ceph.keyring
  3. [root@ceph2 ceph]# ceph-authtool ceph.keyring --import-keyring ceph.client.ning.keyring #把用户client.ning添加进秘钥文件
  4. importing contents of ceph.client.ning.keyring into ceph.keyring
  5. [root@ceph2 ceph]# cat ceph.keyring #查看
  6. [client.ning]
  7. key = AQAcBY5coY/rLxAAvq99xcSOrwLI1ip0WAw2Sw==
  8. [root@ceph2 ceph]# ceph-authtool ceph.keyring --import-keyring ceph.client.joy.keyring #把用户client.ning添加进秘钥文件
  9. importing contents of ceph.client.joy.keyring into ceph.keyring
  10. [root@ceph2 ceph]# cat ceph.keyring #查看有两个用户,可以把这文件推送给客户端,就可以使用这两个用户的权限
  11. [client.joy]
  12. key = AQBiBY5cJ2gBLBAA/ZCGDdp6JWkPuuU0YaLsrw==
  13. [client.ning]
  14. key = AQAcBY5coY/rLxAAvq99xcSOrwLI1ip0WAw2Sw==

博主声明:本文的内容来源主要来自誉天教育晏威老师,由本人实验完成操作验证,需要的博友请联系誉天教育(http://www.yutianedu.com/),获得官方同意或者晏老师(https://www.cnblogs.com/breezey/)本人同意即可转载,谢谢!

005 Ceph配置文件及用户管理的更多相关文章

  1. linux 用户管理(一)

    本节内容梗概: 1.用户管理配置文件 2.用户管理命令 3.用户组管理命令 4.批量添加用户 5.用户授权 学东西先讲原理,所以从配置文件入手 1.用户信息文件  /etc/passwd 存放了用户的 ...

  2. 用户管理 之 用户(User)和用户组(Group)配置文件详解

    用户(User)和用户组(Group)的配置文件,是系统管理员最应该了解和掌握的系统基础文件之一,从另一方面来说,了解这些文件也是系统安全管理的重要组成部份:做为一个合格的系统管理员应该对用户和用户组 ...

  3. 网卡配置文件详解 用户管理与文件权限篇 文件与目录权限 软连接 tar解压命令 killall命令 linux防火墙 dns解析设置 计划任务crond服务 软件包安装 阿里云 yum源 安装

    Linux系统基础优化及常用命令 Linux基础系统优化 引言没有,只有一张图. Linux的网络功能相当强悍,一时之间我们无法了解所有的网络命令,在配置服务器基础环境时,先了解下网络参数设定命令. ...

  4. linux和windows互传文件/用户配置文件和密码配置文件/用户组管理/用户管理

    2.27linux和windows互传文件 3.1 用户配置文件和密码配置文件 3.2 用户组管理 3.3 用户管理 linux和windows互传文件 显示日期date [root@centos_1 ...

  5. Linux 用户篇——用户管理的配置文件

    一.用户管理之配置文件的重要性 在Linux系统中,用户账户的相关信息是存放在相关配置文件中.而Linux安全系统的核心是用户账号,用户对系统中各种对象的访问权限取决于他们登录系统时用的账户,并且Li ...

  6. 【Linux学习】Linux用户管理2—用户配置文件

    Linux用户管理2-用户配置文件 /etc/passwd: 存放系统用户的文件 输入 vi /etc/passwd /etc/shadow: 保存保密文件 /etc/group: 群组文件 输入 v ...

  7. Ceph 的用户管理与认证

    目录 文章目录 目录 前言 Ceph 的用户管理 用户管理常规操作 CephX 认证系统 身份认证原理 使用 ceph-authtool 进行密钥环管理 注意事项 前言 常规的身份认证系统无非三点: ...

  8. Linux CentOS7 VMware linux和windows互传文件、用户配置文件和密码配置文件、用户组管理、用户管理

    一. linux和windows互传文件 X-shell.Securecrt远程终端,与Windows之间互传文件. 安装一个工具lrzsz [root@davery ~]# yum install ...

  9. linux和windows互传文件、用户配置文件和密码配置文件、用户组管理、用户管理...

    linux和windows互传文件 第一种:在linux主机上下载lrzsz软件包 1.yum install lrzsz 2.通过rz命令上传window的文件到linux主机上 用过sz 文件名下 ...

随机推荐

  1. Warning!程序员们小心被技术绑架

    通常我们说程序员需要在某个技术方向上积累到一定的厚度,要能够运用技术有效地解决实际问题.可是当程序员在某一项技术上浸淫时间长了之后,却经常会出现另外的问题,那就是:看待问题时受限于自身的技术积累. 我 ...

  2. 模板—FFT

    卷积:$C[i]=\sum \limits_{j=0}^{i}A[j]*B[i-j]$可以画图理解一下其实就是交叉相乘的和. 卷积可以看作两个多项式乘积的形式,只不过求出的结果的项数不同. FFT讲解 ...

  3. Android中后台线程如何与UI线程交互

    我想关于这个话题已经有很多前辈讨论过了.今天算是一次学习总结吧. 在android的设计思想中,为了确保用户顺滑的操作体验.一些耗时的任务不能够在UI线程中运行,像访问网络就属于这类任务.因此我们必须 ...

  4. LeetCode63 Unique Paths II

    题目: Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. H ...

  5. Oracle中组合索引的使用详解(转)

    在Oracle中可以创建组合索引,即同时包含两个或两个以上列的索引.在组合索引的使用方面,Oracle有以下特点: 1. 当使用基于规则的优化器(RBO)时,只有当组合索引的前导列出现在SQL语句的w ...

  6. CNN如何识别一幅图像中的物体

    让我们对卷积神经网络如何工作形成更好直观感受.我们先看下人怎样识别图片,然后再看 CNNs 如何用一个近似的方法来识别图片. 比如说,我们想把下面这张图片识别为金毛巡回犬.   一个需要被识别为金毛巡 ...

  7. name和code的相关设置

    cdm中同时显示name和code tools->或右键Displace preferences->Entity->Advanced->Attributes->右侧Lis ...

  8. display:flex; justify-content:space-between; 最后一行显示内容无法靠左显示

    给父元素添加同每行展示列数一样(展示列表最多的)的子元素. 子元素设置样式: width:同子元素一样的width : height:0;

  9. ArrayList存储基本类型时的封装类

  10. 微信小程序下拉刷新真机无法弹回

    在下拉函数里加上这句wx.stopPullDownRefresh(); /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { v ...