准备
本地部署虚拟机
本文使用VirtualBox,安装CentOS 7.9 minimal系统。配置IP为192.168.56.101/24。
相关配置方法参考网上即可。
安装ceph相关rpm
本文基于Ceph N版本进行配置。
配置规划
- client.admin keyring:/etc/ceph/ceph.client.admin.keyring
- 通用config:/etc/ceph/ceph.conf
- ceph-mon
- 数据目录:/var/lib/ceph/mon/ceph-node
- 执行权限:root
- ceph-mgr
- 目录:/var/lib/ceph/mgr/ceph-node
- 执行权限:root
- ceph-osd
- 目录:/var/lib/ceph/osd/osd.0
- 执行权限:ceph
- 存储池
- 副本数:1
部署ceph-mon
创建/etc/ceph/ceph.conf配置文件
[global]
fsid = 7ea38da8-2af9-498b-9dc8-05ec5578e761
auth cluster required = cephx
auth service required = cephx
auth client required = cephx
osd journal size = 1024
osd pool default size = 1
osd pool default min size = 1
osd pool default pg num = 256
osd pool default pgp num = 256
osd crush chooseleaf type = 0
mon_allow_pool_delete = true
debug_limit = 30/0
debug_mon = 30/0
debug_mgr = 30/0
[mon.node]
mon_addr = 192.168.56.101:6789
public_addr = 192.168.56.101:6789
创建keyring
创建mon keyring
[root@localhost ~]# ceph-authtool --create-keyring /tmp/ceph.mon.keyring --gen-key -n mon. --cap mon 'allow *'
creating /tmp/ceph.mon.keyring
创建admin keyring
[root@localhost ~]# ceph-authtool --create-keyring /etc/ceph/ceph.client.admin.keyring --gen-key -n client.admin --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow *' --cap mgr 'allow *'
creating /etc/ceph/ceph.client.admin.keyring
将admin keyring追加到mon keyring
[root@localhost ~]# ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/ceph.client.admin.keyring
importing contents of /etc/ceph/ceph.client.admin.keyring into /tmp/ceph.mon.keyring
生成mon keyring为。
[mon.]
key = AQAPINViacPQIRAAT+G