分布式存储系统之Ceph集群CephFS基础使用( 二 )

CephFS客户端账号
启用CephX认证的集群上,CephFS的客户端完成认证后方可挂载访问文件系统;
[root@ceph-admin ~]# ceph auth get-or-create client.fsclient mon 'allow r' mds 'allow rw' osd 'allow rw pool=cephfs-datapool'[client.fsclient]        key = AQDx2z5jgeqiIRAAIxQFz09BF99kcAYxiFwOWg==[root@ceph-admin ~]# ceph auth get client.fsclientexported keyring for client.fsclient[client.fsclient]        key = AQDx2z5jgeqiIRAAIxQFz09BF99kcAYxiFwOWg==        caps mds = "allow rw"        caps mon = "allow r"        caps osd = "allow rw pool=cephfs-datapool"[root@ceph-admin ~]#提示:这里需要注意,对于元数据存储池来说,它的客户端是mds,对应数据的读写都是有mds来完成操作,对于cephfs的客户端来说,他不需要任何操作元数据存储池的权限,我们这里只需要授权用户对数据存储池有读写权限即可;对于mon节点来说,用户只需要有读的权限就好,对mds有读写权限就好;
保存用户账号的密钥信息于secret文件,用于客户端挂载操作认证之用
[root@ceph-admin ~]# ceph auth print-key client.fsclientAQDx2z5jgeqiIRAAIxQFz09BF99kcAYxiFwOWg==[root@ceph-admin ~]# ceph auth print-key client.fsclient -o fsclient.key[root@ceph-admin ~]# cat fsclient.keyAQDx2z5jgeqiIRAAIxQFz09BF99kcAYxiFwOWg==[root@ceph-admin ~]#提示:这里只需要导出key的信息就好,对于权限信息,客户端用不到,客户端拿着key去ceph上认证,对应权限ceph是知道的;
将密钥文件需要保存于挂载CephFS的客户端主机上,我们可以使用scp的方式推到客户端主机之上;客户端主机除了要有这个key文件之外,还需要有ceph集群的配置文件

分布式存储系统之Ceph集群CephFS基础使用

文章插图
提示:我这里以admin host作为客户端使用,将对应key文件复制到/etc/ceph/目录下,对应使用内核模块挂载,指定mount到该目录读取对应key的信息即可;
内核客户端安装必要工具和模块
1、内核模块ceph.ko
2、安装ceph-common程序包
3、提供ceph.conf配置文件和用于认证的密钥文件
[root@ceph-admin ~]# ls /lib/modules/3.10.0-1160.76.1.el7.x86_64/kernel/fs/ceph/ceph.ko.xz[root@ceph-admin ~]# modinfo cephfilename:       /lib/modules/3.10.0-1160.76.1.el7.x86_64/kernel/fs/ceph/ceph.ko.xzlicense:        GPLdescription:    Ceph filesystem for Linuxauthor:         Patience Warnick <patience@newdream.net>author:         Yehuda Sadeh <yehuda@hq.newdream.net>author:         Sage Weil <sage@newdream.net>alias:          fs-cephretpoline:      Yrhelversion:    7.9srcversion:     B1FF0EC5E9EF413CE8D9D1Cdepends:        libcephintree:         Yvermagic:       3.10.0-1160.76.1.el7.x86_64 SMP mod_unload modversionssigner:         CentOS Linux kernel signing keysig_key:        C6:93:65:52:C5:A1:E9:97:0B:A2:4C:98:1A:C4:51:A6:BC:11:09:B9sig_hashalgo:   sha256[root@ceph-admin ~]# yum info ceph-commonLoaded plugins: fastestmirrorRepository epel is listed more than once in the configurationRepository epel-debuginfo is listed more than once in the configurationRepository epel-source is listed more than once in the configurationLoading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.comInstalled PackagesName        : ceph-commonArch        : x86_64Epoch       : 2Version     : 13.2.10Release     : 0.el7Size        : 44 MRepo        : installedFrom repo   : CephSummary     : Ceph CommonURL         : http://ceph.com/License     : LGPL-2.1 and CC-BY-SA-3.0 and GPL-2.0 and BSL-1.0 and BSD-3-Clause and MITDescription : Common utilities to mount and interact with a ceph storage cluster.            : Comprised of files that are common to Ceph clients and servers.[root@ceph-admin ~]# ls /etc/ceph/ceph.client.admin.keyring  ceph.client.test.keyring  ceph.conf  fsclient.key  rbdmap  tmpJ434zL[root@ceph-admin ~]#

经验总结扩展阅读