详解cephfs几种挂载方式

作者:【吴业亮】
博客:https://wuyeliang.blog.csdn.net/

一、启用cephfs

Ceph文件系统至少需要两个RADOS池,一个用于数据,一个用于元数据

启用mds服务

# ceph-deploy mds create node01

创建数据pool

ceph osd pool create cephfs_data 128

创建Metadata池

ceph osd pool create cephfs_metadata 128

启用pool

ceph fs new cephfs cephfs_metadata cephfs_data

查看cephfs

ceph fs ls

**二、挂载cephfs **

挂载cephfs有两种方式,kernel driver和fuse

1、kernel driver挂载

关闭认证情况下

sudo mkdir /mnt/wyl
sudo mount -t ceph 192.168.0.1:6789:/ /mnt/wyl

设置开机自动挂载/etc/fstab

172.16.70.77:6789:/     /mnt/ceph    ceph   noatime,_netdev    0       2

启用认证

# cat ceph.client.admin.keyring
[client.admin]
	key = AQBSdU5bT27AKxAAvKoWQdGpSuNRCHjC4B8DVA==
	
	
# mount -t ceph 172.16.70.77:6789:/ /wyl  -o name=admin,secret=AQBSdU5bT27AKxAAvKoWQdGpSuNRCHjC4B8DVA==

设置开机自动挂载/etc/fstab

172.16.70.77:6789:/     /mnt/ceph    ceph    name=admin,secretfile=/etc/ceph/secret.key,noatime,_netdev    0       2

注意:检查是否启用cephx认证方法,如果值为none为禁用,cephx为启用

[root@node1 ceph]# cat /etc/ceph/ceph.conf   | grep auth | grep required
auth_cluster_required = cephx
auth_service_required = cephx
auth_client_required = cephx

2、fuse挂载

安装挂载工具

# yum -y install ceph-fuse ceph

将存储节点的admin秘钥拷贝到本地

# ssh root@node1 "ceph-authtool -p /etc/ceph/ceph.client.admin.keyring" > admin.key

root@node1’s password:
赋予权限

# chmod 600 admin.key

执行挂载

# mount -t ceph node1:6789:/ /mnt -o name=admin,secretfile=admin.key 
# df -hT

设置开机自动挂载/etc/fstab

id=admin,conf=/etc/ceph/ceph.conf  /mnt fuse.ceph defaults 0 0

mds可以同时启用多个节点,不同的client挂载不同mds存储节点,不同client可以同时写数据,数据是共享的

3、windows挂载:

https://github.com/ksingh7/ceph-cookbook/tree/master/ceph-dokan

安装dokaninstall.exe

你可能感兴趣的:(ceph)