一、Ceph的配置文件

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

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

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

[root@ceph2 ceph]# cat ceph.conf

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

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

1.1 osd介绍

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

[root@ceph2 ceph]# fdisk -l

005 Ceph配置文件及用户管理

OSD的id和磁盘对应关系

[root@ceph2 ceph]# df -hT

005 Ceph配置文件及用户管理

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

[root@ceph2 ceph]# ceph osd tree

005 Ceph配置文件及用户管理

二、删除一个存储池

2.1 修改配置文件

先配置一个参数为mon_allow_pool_delete为true

[root@ceph1 ceph-ansible]#  vim /etc/ceph/ceph.conf
[global]
fsid = 35a91e48-8244-4e96-a7ee-980ab989d20d
mon initial members = ceph2,ceph3,ceph4
mon host = 172.25.250.11,172.25.250.12,172.25.250.13
public network = 172.25.250.0/24
cluster network = 172.25.250.0/24
[osd]
osd mkfs type = xfs
osd mkfs options xfs = -f -i size=2048
osd mount options xfs = noatime,largeio,inode64,swalloc
osd journal size = 5120
[mon]    #添加配置
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'

ceph3 | SUCCESS => {
    "changed": true, 
    "checksum": "18ad6b3743d303bdd07b8655be547de35f9b4e55", 
    "dest": "/etc/ceph/ceph.conf", 
    "failed": false, 
    "gid": 1001, 
    "group": "ceph", 
    "md5sum": "8415ae9d959d31fdeb23b06ea7f61b1b", 
    "mode": "0644", 
    "owner": "ceph", 
    "size": 500, 
    "src": "/root/.ansible/tmp/ansible-tmp-1552807199.08-216306208753591/source", 
    "state": "file", 
    "uid": 1001
}
ceph4 | SUCCESS => {
    "changed": true, 
    "checksum": "18ad6b3743d303bdd07b8655be547de35f9b4e55", 
    "dest": "/etc/ceph/ceph.conf", 
    "failed": false, 
    "gid": 1001, 
    "group": "ceph", 
    "md5sum": "8415ae9d959d31fdeb23b06ea7f61b1b", 
    "mode": "0644", 
    "owner": "ceph", 
    "size": 500, 
    "src": "/root/.ansible/tmp/ansible-tmp-1552807199.09-46038387604349/source", 
    "state": "file", 
    "uid": 1001
}
ceph2 | SUCCESS => {
    "changed": true, 
    "checksum": "18ad6b3743d303bdd07b8655be547de35f9b4e55", 
    "dest": "/etc/ceph/ceph.conf", 
    "failed": false, 
    "gid": 1001, 
    "group": "ceph", 
    "md5sum": "8415ae9d959d31fdeb23b06ea7f61b1b", 
    "mode": "0644", 
    "owner": "ceph", 
    "size": 500, 
    "src": "/root/.ansible/tmp/ansible-tmp-1552807199.04-33302205115898/source", 
    "state": "file", 
    "uid": 1001
}
ceph1 | SUCCESS => {
    "changed": false, 
    "checksum": "18ad6b3743d303bdd07b8655be547de35f9b4e55", 
    "failed": false, 
    "gid": 1001, 
    "group": "ceph", 
    "mode": "0644", 
    "owner": "ceph", 
    "path": "/etc/ceph/ceph.conf", 
    "size": 500, 
    "state": "file", 
    "uid": 1001
}
输出结果

相关文章:

  • 2021-04-28
  • 2021-10-24
  • 2021-04-05
  • 2021-06-11
  • 2021-08-22
  • 2021-09-17
  • 2021-08-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2021-12-31
  • 2021-12-07
  • 2021-10-11
  • 2021-11-02
相关资源
相似解决方案