之前部署的环境未按标准操作,Mon服务起来了,但是未保存keyring,执行命令的时候提示keyring找不到,于是有了这篇文章。
确认keyring丢失,但是mon服务存活
[root@localhost cluter]# ceph -s
2019-08-23 03:32:48.374297 7fe9cfcc4700 -1 auth: unable to find a keyring on /etc/ceph/ceph.client.admin.keyring,/etc/ceph/ceph.keyring,/etc/ceph/keyring,/etc/ceph/keyring.bin,: (2) No such file or directory
2019-08-23 03:32:48.374308 7fe9cfcc4700 -1 monclient: ERROR: missing keyring, cannot use cephx for authentication
2019-08-23 03:32:48.374309 7fe9cfcc4700 0 librados: client.admin initialization error (2) No such file or directory
[errno 2] error connecting to the cluster
[root@localhost cluter]# ls /etc/ceph/
ceph.conf rbdmap tmpFLL2nW tmpwcDbve
[root@localhost cluter]# ps axu|grep mon
dbus 644 0.0 0.2 98476 2144 ? Ssl 01:10 0:00 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root 679 0.0 0.8 695184 9096 ? Ssl 01:10 0:00 /usr/sbin/NetworkManager --no-daemon
ceph 2734 0.0 2.8 409176 28660 ? Ssl 03:32 0:00 /usr/bin/ceph-mon -f --cluster ceph --id localhost --setuser ceph --setgroup ceph
root 2922 0.0 0.0 112708 984 pts/0 R+ 03:39 0:00 grep --color=auto mon
修复就一条命令,如下
[root@localhost cluter]# /usr/bin/ceph --connect-timeout=25 --cluster=ceph --name mon. --keyring=/var/lib/ceph/mon/ceph-localhost/keyring auth get-or-create client.admin osd 'allow *' mon 'allow *' mds 'allow *' > /etc/ceph/ceph.client.admin.keyring
[root@localhost cluter]# ceph -s
cluster:
id: 25d59c28-01b8-435a-a28a-1215d6989376
health: HEALTH_OK
services:
mon: 1 daemons, quorum localhost
mgr: no daemons active
osd: 0 osds: 0 up, 0 in
data:
pools: 0 pools, 0 pgs
objects: 0 objects, 0B
usage: 0B used, 0B / 0B avail
pgs:
[root@localhost cluter]# cat /etc/ceph/ceph.client.admin.keyring
[client.admin]
key = AQBkl19d7s9hGxAARyleINJggH9sA6aunSkTLg==