Ceph Luminous版本创建OSD无法激活问题
一.问题描述
部署ceph的Luminous之ceph-12.2.10版本,在其中一个集群节点部署OSD时,发现命令执行完毕后,集群中并没有将格式化的盘加入到OSD中,也没有任何报错,问题如下:
[root@k8s-node2 ceph]# ceph-disk prepare --bluestore /dev/sdb
Creating new GPT entries.
Setting name!
partNum is 0
REALLY setting name!
The operation has completed successfully.
Setting name!
partNum is 1
REALLY setting name!
The operation has completed successfully.
The operation has completed successfully.
meta-data=/dev/sdb1 isize=2048 agcount=4, agsize=6400 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=25600, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=864, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.
执行完毕后,结果如下:
[root@k8s-node2 ceph]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 39G 0 part
├─centos-root 253:0 0 37G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk
├─sdb1 8:17 0 100M 0 part
└─sdb2 8:18 0 19.9G 0 part
sdc 8:32 0 30G 0 disk
sr0 11:0 1 906M 0 rom
发现OSD并没有挂载成功
二.问题解决
对比集群的其它节点,查看配置文件没有问题,查看bootstrap-osd目录,发现此目录为空:
[root@k8s-node2 ceph]# ll -a /var/lib/ceph/bootstrap-osd/
total 4
drwxr-x--- 2 root root 26 Dec 10 01:26 .
drwxr-x--- 12 ceph ceph 166 Dec 10 04:14 ..
将集群主节点的ceph.keyring文件复制到此目录下,执行OSD的集群命令:
[root@k8s-node2 ceph]# ceph-disk activate /dev/sdb1
Created symlink from /run/systemd/system/ceph-osd.target.wants/ceph-osd@4.service to /usr/lib/systemd/system/ceph-osd@.service.
OSD激活成功:
[root@k8s-node2 ceph]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 39G 0 part
├─centos-root 253:0 0 37G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk
├─sdb1 8:17 0 100M 0 part /var/lib/ceph/osd/ceph-4
└─sdb2 8:18 0 19.9G 0 part
sdc 8:32 0 30G 0 disk
sr0 11:0 1 906M 0 rom