前文我们使用ceph-deploy工具简单拉起了ceph底层存储集群RADOS , 回顾请参考https://www.cnblogs.com/qiuhom-1874/p/16724473.html;今天我们来聊一聊ceph集群访问接口相关话题;
我们知道RADOS集群是ceph底层存储集群,部署好RADOS集群以后,默认只有RBD(Rados Block Device)接口;但是该接口并不能使用;这是因为在使用rados存储集群存取对象数据时,都是通过存储池找到对应pg,然后pg找到对应的osd,由osd通过librados api接口将数据存储到对应的osd所对应的磁盘设备上;
启用Ceph块设备接口(RBD)
对于RBD接口来说,客户端基于librbd即可将RADOS存储集群用作块设备,不过,用于rbd的存储池需要事先启用rbd功能并进行初始化;
1、创建RBD存储池
[root@ceph-admin ~]# ceph osd pool create rbdpool 64 64pool 'rbdpool' created[root@ceph-admin ~]# ceph osd pool lstestpoolrbdpool[root@ceph-admin ~]#2、启用RBD存储池RBD功能
查看ceph osd pool 帮助
Monitor commands: =================osd pool application disable <poolname> <app> {--yes-disables use of an application <app> on pool i-really-mean-it}<poolname>osd pool application enable <poolname> <app> {--yes-i- enable use of an application <app> [cephfs,rbd,rgw] really-mean-it}on pool <poolname>提示:ceph osd pool application disable 表示禁用对应存储池上的对应接口功能,enbale 表示启用对应功能;后面的APP值只接受cephfs、rbd和rgw;
[root@ceph-admin ~]# ceph osd pool application enable rbdpool rbdenabled application 'rbd' on pool 'rbdpool'[root@ceph-admin ~]#3、初始化RBD存储池
[root@ceph-admin ~]# rbd pool init -p rbdpool[root@ceph-admin ~]#验证rbdpool是否成功初始化 , 对应rbd应用是否启用?
![分布式存储系统之Ceph集群访问接口启用](http://img.zhejianglong.com/231018/0001425U2-0.png)
文章插图
提示:使用ceph osd pool ls detail命令就能查看存储池详细信息;到此rbd存储池就初始化完成;但是,rbd存储池不能直接用于块设备,而是需要事先在其中按需创建映像(image),并把映像文件作为块设备使用;
4、在rbd存储池里创建image
[root@ceph-admin ~]# rbd create --size 5G rbdpool/rbd-img01[root@ceph-admin ~]# rbd ls rbdpoolrbd-img01[root@ceph-admin ~]#查看创建image的信息
[root@ceph-admin ~]# rbd info rbdpool/rbd-img01rbd image 'rbd-img01':size 5 GiB in 1280 objectsorder 22 (4 MiB objects)id: d4466b8b4567block_name_prefix: rbd_data.d4466b8b4567format: 2features: layering, exclusive-lock, object-map, fast-diff, deep-flattenop_features:flags:create_timestamp: Sun Sep 25 11:25:01 2022[root@ceph-admin ~]#提示:可以看到对应image支持分层镜像,排他锁,对象映射等等特性;到此一个5G大小的磁盘image就创建好了;客户端可以基于内核发现机制将对应image识别成一块磁盘设备进行使用;
启用radosgw接口
RGW并非必须的接口,仅在需要用到与S3和Swift兼容的RESTful接口时才需要部署RGW实例;radosgw接口依赖ceph-rgw进程对外提供服务;所以我们要启用radosgw接口,就需要在rados集群上运行ceph-rgw进程;
1、部署ceph-radosgw
[root@ceph-admin ~]# ceph-deploy rgw --helpusage: ceph-deploy rgw [-h] {create} ...Ceph RGW daemon managementpositional arguments:{create}createCreate an RGW instanceoptional arguments:-h, --helpshow this help message and exit[root@ceph-admin ~]#提示:ceph-deploy rgw命令就只有一个create子命令用于创建RGW实例;
[root@ceph-admin ~]# su - cephadmLast login: Sat Sep 24 23:16:00 CST 2022 on pts/0[cephadm@ceph-admin ~]$ cd ceph-cluster/[cephadm@ceph-admin ceph-cluster]$ ceph-deploy rgw create ceph-mon01[ceph_deploy.conf][DEBUG ] found configuration file at: /home/cephadm/.cephdeploy.conf[ceph_deploy.cli][INFO] Invoked (2.0.1): /bin/ceph-deploy rgw create ceph-mon01[ceph_deploy.cli][INFO] ceph-deploy options:[ceph_deploy.cli][INFO]username: None[ceph_deploy.cli][INFO]verbose: False[ceph_deploy.cli][INFO]rgw: [('ceph-mon01', 'rgw.ceph-mon01')][ceph_deploy.cli][INFO]overwrite_conf: False[ceph_deploy.cli][INFO]subcommand: create[ceph_deploy.cli][INFO]quiet: False[ceph_deploy.cli][INFO]cd_conf: <ceph_deploy.conf.cephdeploy.Conf instance at 0x7fa658caff80>[ceph_deploy.cli][INFO]cluster: ceph[ceph_deploy.cli][INFO]func: <function rgw at 0x7fa6592f5140>[ceph_deploy.cli][INFO]ceph_conf: None[ceph_deploy.cli][INFO]default_release: False[ceph_deploy.rgw][DEBUG ] Deploying rgw, cluster ceph hosts ceph-mon01:rgw.ceph-mon01[ceph-mon01][DEBUG ] connection detected need for sudo[ceph-mon01][DEBUG ] connected to host: ceph-mon01[ceph-mon01][DEBUG ] detect platform information from remote host[ceph-mon01][DEBUG ] detect machine type[ceph_deploy.rgw][INFO] Distro info: CentOS Linux 7.9.2009 Core[ceph_deploy.rgw][DEBUG ] remote host will use systemd[ceph_deploy.rgw][DEBUG ] deploying rgw bootstrap to ceph-mon01[ceph-mon01][DEBUG ] write cluster configuration to /etc/ceph/{cluster}.conf[ceph-mon01][WARNIN] rgw keyring does not exist yet, creating one[ceph-mon01][DEBUG ] create a keyring file[ceph-mon01][DEBUG ] create path recursively if it doesn't exist[ceph-mon01][INFO] Running command: sudo ceph --cluster ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/ceph.keyring auth get-or-create client.rgw.ceph-mon01 osd allow rwx mon allow rw -o /var/lib/ceph/radosgw/ceph-rgw.ceph-mon01/keyring[ceph-mon01][INFO] Running command: sudo systemctl enable ceph-radosgw@rgw.ceph-mon01[ceph-mon01][WARNIN] Created symlink from /etc/systemd/system/ceph-radosgw.target.wants/ceph-radosgw@rgw.ceph-mon01.service to /usr/lib/systemd/system/ceph-radosgw@.service.[ceph-mon01][INFO] Running command: sudo systemctl start ceph-radosgw@rgw.ceph-mon01[ceph-mon01][INFO] Running command: sudo systemctl enable ceph.target[ceph_deploy.rgw][INFO] The Ceph Object Gateway (RGW) is now running on host ceph-mon01 and default port 7480[cephadm@ceph-admin ceph-cluster]$
推荐阅读
- 分布式存储系统之Ceph集群部署
- ERP 系统的核心是什么?有什么作用?
- 分布式存储系统之Ceph基础
- 适合生产制造企业用的ERP系统有哪些?
- 制造业数字化转型,本土云ERP系统如何卡位?
- MES系统和ERP系统的区别是什么?
- MES系统与ERP系统信息集成有哪些原则?
- 企业MES系统与ERP信息集成要素有哪些?
- 关于HM NISEDIT在新版系统下编译并运行提示权限不足问题的解决方案
- 荣耀magic3可以升级鸿蒙系统吗_荣耀magic3能不能升级鸿蒙系统