1月 042018
 

由于我的rbd image中都是一个相同的基础镜像,里面的文件系统都一样,相同的xfs文件系统格式,相同的文件系统id;所以,就算可以rbd map多个,也不能同时mount多个,因为文件系统id一样啊。

问题是,我已经umount了rbd image1,再去mount rbd image2,为啥还是提示:

原因: 虽然umount了,但是相关的xfs后台进程并没有退出,所以,可以进一步unmap掉那个不需要的设备,xfs进程就会退出:

 Posted by at 上午 11:02
12月 182017
 

表象:

kvm虚拟机vm的nic使用virio驱动,在vm流量大的时候,vm就直接断网了; 我们原本有多台vm的,但是其中几台已经多次出现断网的情况,重启vm就好使了;我以为这个vm有问题,后来其他的vm也出现类似问题,我才察觉,其实是这台vm的流量通常更高,出现问题的概率大而已。

虚拟机信息:

宿主机信息:

 

我的问题和 https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/997978 基本是一样的

 

解决办法:

重新attach网络接口:

  1. 查看接口信息
  2. 分离网络接口
  3. 挂载网络接口(网卡接口信息都是上面查看到的)
  4. 启动网卡
  5. xx

 

参考:

https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/1050934

https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/997978

 Posted by at 下午 2:21
12月 112017
 

ceph-bluestore-tool 可以对bluestore 文件系统进行检查:

注意: 必须把对应的osd停掉才行

 Posted by at 下午 12:10
12月 062017
 

取消某个mon的法人资格:

恢复一个mon的法人资格

不幸的是,该命令卡死不动;甚至,如果期望提示enter补全都会卡死不动; 哪怕是4个mon,exit一个再tell回来也是卡死的,所以,tell命令似乎只能取消法人资格,不能恢复法人资格

 

方法2: 直接在需要恢复法人资格的daemon上执行如下命令

 Posted by at 下午 7:01
11月 302017
 

通过ssh远程top一次ceph用户的所有进程:

如果想查看多次(3次):

如果想以本机的top效果查看,则可以:

其实,根本不用watch :

但是如果想在一个机器上查看2个机器的top呢?

如果如果想在一个机器上查看4个机器的top呢?写4遍ssh好繁琐:

分割线的打印,参考: https://stackoverflow.com/questions/5349718/how-can-i-repeat-a-character-in-bash

 

 Posted by at 下午 3:44
11月 072017
 

由于对ceph-mon不甚了解,做了下面一件事情:

  1. openstack存储完全基于ceph存储
  2. ceph存储节点单独部署
  3. 现有ceph-mon节点2个(mon-1,mon-2),想重装mon-1;但是,没有了ceph-1之后,ceph-2似乎认为脑裂了,不提供服务;于是想找个临时mon顶上
  4. 在openstack集群上很轻松地申请了一台机器,很快变安装了一个mon-3,由于安全组(没有放开6789)的原因,虽然mon-3能够找到mon-2,ceph -s也能看到,但是mon-1却因为不能连接到mon-3使得mon-3没有完全加入,调整安全组后,似乎一切变的正常,当mon-1去掉之后,ceph -s 卡住了,mon-3中正在执行的yum也卡住了
  5. 观察发现,mon-2 出于probing状态,mon-3出于reop状态,没有leader了
    1. 因为mon-3 依赖ceph,但是ceph没有了leader,mon-3就不能落地数据
    2. mon-3不能落地数据的话,mon-2、mon-3之间就没法选举出来leader
    3. 如此,事情进入僵局,死锁了
  6. 分析:
    1. 每个mon上都存在一个db,里面放着monmap信息,启动的时候,就根据monmap中的信息加入集群,如果monmap中只有自己,直接启动就可以了,如果有多个mon节点,并且当前不存在leader就得选举
    2. 如果能把monmap中的mon节点修改成只有自己,就能正常启动
  7.  解决办法:(参考: http://docs.ceph.com/docs/jewel/rados/troubleshooting/troubleshooting-mon/#recovering-a-monitor-s-broken-monmap )
    1. 停掉mon-2,不停掉是操作不了monmap的db的
    2. 导出monmap:
      ceph-mon -i ID-FOO –extract-monmap /tmp/monmap
    3. 查看monmap:
      monmaptool –print -f /tmp/monmap
    4. 删除mon-3
      monmaptool –rm mon-3  -f /tmp/monmap
    5. 注入monmap
      ceph-mon -i ID –inject-monmap /tmp/monmap
    6. 启动mon-2

 

Inject a monmap into the monitor

Usually the safest path. You should grab the monmap from the remaining monitors and inject it into the monitor with the corrupted/lost monmap.

These are the basic steps:

  1. Is there a formed quorum? If so, grab the monmap from the quorum:

  2. No quorum? Grab the monmap directly from another monitor (this assumes the monitor you’re grabbing the monmap from has id ID-FOO and has been stopped):

  3. Stop the monitor you’re going to inject the monmap into.

  4. Inject the monmap:

  5. Start the monitor

Please keep in mind that the ability to inject monmaps is a powerful feature that can cause havoc with your monitors if misused as it will overwrite the latest, existing monmap kept by the monitor.

What if the state is probing?

This means the monitor is still looking for the other monitors. Every time you start a monitor, the monitor will stay in this state for some time while trying to find the rest of the monitors specified in the monmap. The time a monitor will spend in this state can vary. For instance, when on a single-monitor cluster, the monitor will pass through the probing state almost instantaneously, since there are no other monitors around. On a multi-monitor cluster, the monitors will stay in this state until they find enough monitors to form a quorum – this means that if you have 2 out of 3 monitors down, the one remaining monitor will stay in this state indefinitively until you bring one of the other monitors up.

If you have a quorum, however, the monitor should be able to find the remaining monitors pretty fast, as long as they can be reached. If your monitor is stuck probing and you have gone through with all the communication troubleshooting, then there is a fair chance that the monitor is trying to reach the other monitors on a wrong address. mon_status outputs the monmap known to the monitor: check if the other monitor’s locations match reality. If they don’t, jump to Recovering a Monitor’s Broken monmap; if they do, then it may be related to severe clock skews amongst the monitor nodes and you should refer to Clock Skews first, but if that doesn’t solve your problem then it is the time to prepare some logs and reach out to the community (please refer to Preparing your logs on how to best prepare your logs).

 Posted by at 下午 4:25
11月 022017
 

背景:

由于原来的ceph-4的系统盘没有做raid,为了更加靠谱,决定重装ceph-4; 首先,按照官方文档给出的方法,一个一个卸掉osd,然后

 

但是,发现crush中还是存在ceph-4,虽然没有了osd,看着很是碍眼,于是看了写help,执行

然后,crush中就看不到ceph-4了

后来,ceph-4重装后,执行:

结果,ceph osd tree时,发现 ceph-4 在crush中的结构和别的host不一样,无论如何也不向这里的osd分配数据,如下:

 

后经 Ceph中国社区2群 @孤舟 指点,他说我的pool走的都是default,ceph-4 没有在default,然而,我根本不知道是哪里的不同导致出现了这样的差异,于是@孤舟 赐我一锦囊,拆看如下:

结果:

 

疑问:

ceph-1 ceph-2 ceph-3 ceph-4 ceph-5 我都是按照相同的命令来执行的,为什么ceph-4就例外了呢?

我能想到的ceph-4唯一的不同就是ceph-4曾经存在过,可能删除的时候没有处理利索,难道是:

使用的不当? 文档中还有一个

的用法,不知道二者有何差异,不过很可能是这样:

这个remove似乎也可以移除osd的,但是purge似乎对于osd来讲更加彻底

 

稍后研究

 

问题2

  • ceph osd out 的时候会rebalance一次
    • 这次是因为数据的问题
  • ceph osd purge 的时候(也可能是ceph osd crush remove ceph-4 的时候)也会rebalance一次
    • 这次是因为hash的问题
  • 那么,能否通过设置 ceph osd set norebalance ,避免两次rebalance呢?似乎不行,set norebalance似乎只对于osd down掉有效,而out、remove操作似乎都不参考该设置,参考: http://www.xuxiaopang.com/2016/11/11/doc-ceph-table/

问题3

一个host下面一般有多个osd,一个一个地purge有点儿麻烦,能否直接ceph osd crush remove <host> 呢?

答案是: 不可以的,就如同不能直接删除非空目录一个道理:

rebalance 时间预估

移除osd之前: 572 GB

 

移除osd以后: 399GB

应该说有 572-399 = 173GB的数据需要找回来, 然后计算带宽就行了,我这里的恢复速度也就 70MB/s ,如此计算的话: 173*1024/70/60=42 分钟

一般来讲,每秒700MB的网络才算正常,那样的话4分钟就能搞定

 

我的实际情况: 18:16:04 开始恢复, 18:46 的时候才恢复情况如下:(30分钟大约 50% 的样子)

结论:

crush要搞明白

 Posted by at 下午 5:19

cephfs

 Ceph  No Responses »  3,143 
10月 252017
 
  1. 一个cephfs可以add多个data pool,下面以单独的名为cephfs_data 的data pool为例说明
  2. 每个文件系统中的文件都在cephfs_data 这个pool中产生前缀相同的多个object,如:

    产生3个rados object

    三个对象分别在不同的pg、不同的osd上:
  3. 文件删除后,rados object会不立即消失,至少是一个异步的过程,可能几秒后才被删除
 Posted by at 下午 3:48
10月 252017
 

关于osd的主从复制:

说明:

  1. 如此架构,写入性能取决于三个osd中最慢的osd的性能,似乎有些不妥;不过,每个osd都在同时担任多种角色,就不应该允许有问题的osd提供服务;另外,有工具可以发现那个osd响应慢

 

在一共4台机器,13个osd的情况下,某osd已经和其它osd创建了60个连接了:

 

参考: http://docs.ceph.com/docs/master/architecture/

 Posted by at 下午 3:14