关于ceph client创建RBD报错的解决方法

来源:互联网 发布:java sleep cpu 编辑:程序博客网 时间:2024/06/05 08:06

今天使用ceph client创建一个10240M大小的RADOS块设备,出现了一个错误:

[client-01][WARNIN] E: Unable to locate package ceph-osd
[client-01][WARNIN] E: Unable to locate package ceph-mon
[client-01][ERROR ] RuntimeError: command returned non-zero exit status: 100
[ceph_deploy][ERROR ] RuntimeError: Failed to execute command: env DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get --assume-yes -q --no-install-recommends install ceph-osd ceph-mds ceph-mon radosgw

经过一番查找原因,发现原来是ceph client的版本和ceph节点不一致,查看ceph版本:

ceph -v

ceph节点的版本是hammer(ceph version 0.94.9);
client节点的版本是jewel(ceph version 10.45.9);

Note: 应该是安装的时候自动更新到了jewel版本。


找到了原因就好说了,开始对ceph client的版本进行降级。

首先,我在ceph部署节点将ceph client的软件包卸载掉,命令如下:

ceph-deploy --username root uninstall client-01

清除ceph client的相关数据:

ceph-deploy purgedata client-01

重启ceph client:

reboot

然后,在ceph client节点部署和ceph节点相同的hammer版本,命令如下:

ceph-deploy --username root install --release hammer --repo-url https://mirrors.aliyun.com/ceph/debian-hammer/ --gpg-url https://mirrors.aliyun.com/ceph/keys/release.asc client-01

Note: 如果不指定版本,ceph将会自动更新成最新的jewel,更新源我改成了国内阿里源

如果不出问题,那么你就成功了。

或许你会跟我人品一样,出了以下问题:

[client-01][DEBUG ] Hit http://cn.archive.ubuntu.com trusty/restricted Translation-en
[client-01][DEBUG ] Hit http://cn.archive.ubuntu.com trusty/universe Translation-en
[client-01][DEBUG ] Ign http://download.ceph.com trusty/main Translation-en_US
[client-01][DEBUG ] Ign http://download.ceph.com trusty/main Translation-en
[client-01][DEBUG ] Ign http://cn.archive.ubuntu.com trusty/main Translation-en_US
[client-01][DEBUG ] Ign http://cn.archive.ubuntu.com trusty/multiverse Translation-en_US
[client-01][DEBUG ] Ign http://cn.archive.ubuntu.com trusty/restricted Translation-en_US
[client-01][DEBUG ] Ign http://cn.archive.ubuntu.com trusty/universe Translation-en_US
[client-01][DEBUG ] Reading package lists...
[client-01][INFO ] Running command: env DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get --assume-yes -q --no-install-recommends install ceph-osd ceph-mds ceph-mon radosgw
[client-01][DEBUG ] Reading package lists...
[client-01][DEBUG ] Building dependency tree...
[client-01][DEBUG ] Reading state information...
[client-01][WARNIN] E: Unable to locate package ceph-osd
[client-01][WARNIN] E: Unable to locate package ceph-mon
[client-01][ERROR ] RuntimeError: command returned non-zero exit status: 100
[ceph_deploy][ERROR ] RuntimeError: Failed to execute command: env DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get --assume-yes -q --no-install-recommends install ceph-osd ceph-mds ceph-mon radosgw

这下又该怎么解决呢?

没有其他办法了,尝试在客户端手动安装一下ceph吧,命令如下:

apt-get install ceph

前提需要将/etc/apt/source.list.d/ceph.list改成hammer版本:

deb http://download.ceph.com/debian-hammer trusty main

安装没问题,完成!

最后将ceph的配置文件复制到ceph client节点,然后创建用户、添加密钥就可以了。

尝试创建一个10240M的RADOS块设备:

rbd create rbd1 --size 10240 --name client.rbd

OK, 没问题!

1 0