cephfs几种挂载方式

一、启用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

原文地址
https://blog.csdn.net/wylfengyujiancheng/article/details/81102717

我是为什么所搜这个博客的

我的问题出现为:

4、客户端准备key验证文件

说明:ceph默认启用了cephx认证,所以客户端的挂载必须要认证

[root@lsy ~ 09:52:52]# mount -t ceph  10.0.0.5:6789:/ /mnt -o name=admin,secret=AQBQ0J5eLDHnLRAAf850/HEvbZd3DAvWE8czrA==
[root@lsy ~ 09:54:04]# df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root xfs        47G  3.6G   44G   8% /
devtmpfs                devtmpfs  475M     0  475M   0% /dev
tmpfs                   tmpfs     487M     0  487M   0% /dev/shm
tmpfs                   tmpfs     487M   14M  473M   3% /run
tmpfs                   tmpfs     487M     0  487M   0% /sys/fs/cgroup
/dev/sda1               xfs      1014M  133M  882M  14% /boot
tmpfs                   tmpfs      98M     0   98M   0% /run/user/0
10.0.0.5:6789:/         ceph      5.0G     0  5.0G   0% /mnt
[root@lsy ~ 09:54:13]#

这样的方式可以

但是使用文件密钥的方式我就实现不出来。

[root@lsy ~ 10:05:42]# mount -t ceph ceph1:6789:/   /mnt -o name=admin,secretfile=/root/admin.key
mount: wrong fs type, bad option, bad superblock on ceph1:6789:/,
       missing codepage or helper program, or other error

   In some cases useful info is found in syslog - try
   dmesg | tail or so.
[167426.541484] libceph: resolve 'ceph1' (ret=0): 10.0.0.5:0
[167426.541490] libceph: bad option at 'secretfile=/root/admin.key'
[167464.108667] libceph: resolve 'ceph1' (ret=0): 10.0.0.5:0
[167464.108673] libceph: bad option at 'secretfile=/root/admin.key'
[167526.348359] libceph: resolve 'ceph1' (ret=0): 10.0.0.5:0
[167526.348365] libceph: bad option at 'secretfile=/root/admin.key'
[167601.044799] libceph: mon0 10.0.0.5:6789 session established

可以使用密钥认证的方式进行挂载,但是将密钥放入到文件中就无法挂载,出现报错。
查看信息也没有得出什么结论。

dmesg命令 用于检测和控制内核缓冲

程序用来帮用户了解系统的启动信息,用户只需要使用命令

在这里插入图片描述

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值