ceph操作备忘及问题解决
操作备忘
- 添加新的节点
ceph-deploy install client_2 # client_2 节点事先要准备好apt源
ceph-deploy disk list client_2
ceph-deploy disk zap client_2 /dev/sdb2
ceph-deploy osd create --data /dev/sdb2 client_2
- 测试存储池
往ceph里上传文件:
格式: raods pul <文件名> <文件名的绝对路径> -p <存储池名字>
root@client_1:~# rados put puttest.log /root/puttest.log -p cephfs_data
查看存储池文件:
格式: rados ls -p <存储池名字>
root@client_1:~# rados ls -p cephfs_data
删除ceph里的文件:
格式: rados rm <要删除的文件名> -p <存储池名字>
root@client_1:~# rados rm puttest.log -p cephfs_data
遇到的问题及解决
问题一 删除存储池时报错
root@client_1:~# ceph osd pool rm k8s k8s --yes-i-really-really-mean-it # 名字要输两遍
Error EPERM: pool deletion is disabled; you must first set the mon_allow_pool_delete config option to true before you can destroy a pool
问题一解决方法
再mon机器上添加以下两行,然后重启
root@client_1:~# vim /etc/ceph/ceph.conf
[mon]
mon allow pool delete = true
root@client_1:~# systemctl restart ceph-mon.target
=====================================================================================================
问题二:
root@client_2:~# ceph health detail
HEALTH_ERR 1 filesystem is offline; 1 filesystem is online with fewer MDS than max_mds
这是因为文件系统需要启动 ceph-mds,ceph-mds 用来管理文件系统的元数据,只有文件系统才需要,对象储存和块储存都不需要。
问题二解决方案:
在管理节点上使用:
root@master:~# ceph-deploy mds create client_1
显示使用ceph -s 查看应该是ok状态了