0. 概述

今天想通过 ceph 挂载本地文件目录,但是直接使用 mount 出错了,报错内容为:

[[email protected]]# mount -t ceph 127.0.0.1:/ ceph
mount error 22 = Invalid argument

1. 定位过程

于是就想定位一下,首先先看 dmesg,然后看到了这样的错误:

[[email protected]]# dmesg
... ...
[449868.033892] libceph: no secret set (for auth_x protocol)
[449868.033963] libceph: error -22 on auth protocol 2 init

噢噢,看上去是没有添加认证文件,那知道问题了,看上去就比较容易了。查询一下挂在 ceph 的参数,于是事情就解决了。

2. 解决方法

[[email protected]]# cd /opt/ceph
[[email protected]]#  cat ceph.client.admin.keyring 
[client.admin]
    key = AQC2FLhea2/xKBAADkz7gaVtb7nrMaVsZsqxdA==
[[email protected]]# echo "AQC2FLhea2/xKBAADkz7gaVtb7nrMaVsZsqxdA==" > /opt/ceph/admin.secret
[[email protected]]# mount -t ceph 127.0.0.1:/ /mnt/ceph -o name=admin,secretfile=/opt/ceph/admin.secret

这样就可以了。

3. Ref