我正在尝试用docker容器设置CEPH集群,但是我无法运行OSD的容器。我使用以下命令运行监视器容器:

docker run -d --net=host --name MON -v /etc/ceph:/etc/ceph -v /var/lib/ceph/:/var/lib/ceph -e MON_IP=1.1.1.1 -e CEPH_PUBLIC_NETWORK=1.1.1.0/24 ceph/daemon mon

然后要运行OSD,我使用:
docker run -d --net=host --name OSD --privileged=true -v /etc/ceph:/etc/ceph -v /var/lib/ceph/:/var/lib/ceph -v /dev/:/dev/ -e OSD_DEVICE=/dev/sdc ceph/daemon osd_ceph_disk

但它失败了,日志如下:
2019-05-10 13:28:59  /opt/ceph-container/bin/entrypoint.sh: static: does not generate config
Error: /dev/sdc: unrecognised disk label
2019-05-10 13:28:59  /opt/ceph-container/bin/entrypoint.sh: Device detected, assuming ceph-disk scenario is desired
2019-05-10 13:28:59  /opt/ceph-container/bin/entrypoint.sh: Preparing and activating /dev/sdc
HEALTH_WARN 1 osds down; 1 host (1 osds) down; 1 root (1 osds) down; no active mgr
Error: /dev/sdc: unrecognised disk label
/opt/ceph-container/bin/osd_disk_prepare.sh: line 46: ceph-disk: command not found

我在同一个设备上运行监视器和OSD,我确信主机上存在/dev/sdc。我有docker1.12.6, build 5680db5/1.12.6版本。
ceph -s监视器输出:
    id:     5bf42838-97f0-492b-81ac-58c7c39a56b3
    health: HEALTH_WARN
            1 osds down
            1 host (1 osds) down
            1 root (1 osds) down
            no active mgr
            mon localhost is low on available space

  services:
    mon:        1 daemons, quorum localhost (age 3d)
    mgr:        no daemons active (since 4d)
    mds:        cephfs:1 {0=demo=up:active(laggy or crashed)}
    osd:        2 osds: 0 up (since 4d), 1 in (since 5d)
    rbd-mirror: 1 daemon active (4137)
    rgw:        1 daemon active (localhost)

  data:
    pools:   8 pools, 64 pgs
    objects: 250 objects, 5.3 KiB
    usage:   1.0 GiB used, 9.0 GiB / 10 GiB avail
    pgs:     64 active+clean

我想达到的最后一个目标是使用块设备存储的最小docker ceph cluser。

最佳答案

我知道我的回答不能解决你的问题,但你为什么不用rook[1]?Rook与k8s[2]完美结合,已经被云计算基金会孵化项目接受,在slack[3]上有一个很棒的社区。
你应该试试。
[1]https://rook.io/
[2]https://rook.io/docs/rook/master/ceph-quickstart.html
[3]https://slack.rook.io/
干杯!

关于linux - 如何为CEHP配置OSD容器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56114048/

10-15 20:25