目标
创建 ceph filestore
用户授权
filestore 需要用到 client.bootstrap-osd 用户,因此需要先添加用户权限
# ceph auth get-or-create client.bootstrap-osd mon 'allow profile bootstrap-osd'
# ceph auth get-or-create client.bootstrap-mds mon 'allow profile bootstrap-mds'
# ceph auth get-or-create client.bootstrap-mgr mon 'allow profile bootstrap-mgr'
# ceph auth get-or-create client.storegw-external mon 'allow r' osd 'allow *'
生成 keyring
# ceph auth get client.bootstrap-osd -o /var/lib/ceph/bootstrap-osd/ceph.keyring
# ceph auth get client.bootstrap-mds -o /var/lib/ceph/bootstrap-mds/ceph.keyring
# ceph auth get client.bootstrap-mgr -o /var/lib/ceph/bootstrap-mgr/ceph.keyring
合并到 admin keyring
# ceph-authtool /etc/ceph/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-osd/ceph.keyring
importing contents of /var/lib/ceph/bootstrap-osd/ceph.keyring into /etc/ceph/ceph.mon.keyring
# ceph-authtool /etc/ceph/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-mds/ceph.keyring
importing contents of /var/lib/ceph/bootstrap-mds/ceph.keyring into /etc/ceph/ceph.mon.keyring
# ceph-authtool /etc/ceph/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-mgr/ceph.keyring
importing contents of /var/lib/ceph/bootstrap-mgr/ceph.keyring into /etc/ceph/ceph.mon.keyring
osd
磁盘准备
需要使用到 ssd 磁盘用于 journal disk (约 2GB 以上分区)
需要使用 hhd 用于 data disk
journal disk 需要预先进行分区格式化
data disk 不需要预先分区格式化
osd create
参考创建 osd 过程, 一个命令即可完成所有操作
# ceph-volume lvm create --filestore --data /dev/sdb --journal /dev/sdv1
Running command: /bin/ceph-authtool --gen-print-key
Running command: /bin/ceph --cluster ceph --name client.bootstrap-osd --keyring /var/lib/ceph/bootstrap-osd/ceph.keyring -i - osd new e0574137-1f39-422c-a919-0d06916e2932
Running command: vgcreate --force --yes ceph-7811ae8d-4032-4246-bfab-02a8dd47b8df /dev/sdb
stdout: Physical volume "/dev/sdb" successfully created.
stdout: Volume group "ceph-7811ae8d-4032-4246-bfab-02a8dd47b8df" successfully created
Running command: lvcreate --yes -l 100%FREE -n osd-data-e0574137-1f39-422c-a919-0d06916e2932 ceph-7811ae8d-4032-4246-bfab-02a8dd47b8df
stdout: Logical volume "osd-data-e0574137-1f39-422c-a919-0d06916e2932" created.
Running command: /bin/ceph-authtool --gen-print-key
Running command: mkfs -t xfs -f -i size=2048 /dev/ceph-7811ae8d-4032-4246-bfab-02a8dd47b8df/osd-data-e0574137-1f39-422c-a919-0d06916e29