查看ceph集群

ceph -s
    cluster 4ae8b795-a8b2-4904-9573-f6f658838db3
     health HEALTH_OK
     monmap e1: 1 mons at {mon0=10.64.0.4:6789/0}
            election epoch 1, quorum 0 mon0
     osdmap e14: 3 osds: 3 up, 3 in
      pgmap v27: 64 pgs, 1 pools, 0 bytes data, 0 objects
            15459 MB used, 319 GB / 334 GB avail
                  64 active+clean
ceph osd tree
ID WEIGHT  TYPE NAME          UP/DOWN REWEIGHT PRIMARY-AFFINITY 
-1 3.00000 root default                                         
-2 1.00000     host m1.vm.org                                   
 0 1.00000         osd.0           up  1.00000          1.00000 
-3 1.00000     host compute                                     
 1 1.00000         osd.1           up  1.00000          1.00000 
-4 1.00000     host network                                     
 2 1.00000         osd.2           up  1.00000          1.00000

添加mon需要的文件

  • ceph.conf - The main ceph configuration file, which may be obtained from an existing ceph monitor

  • ceph.client.admin.keyring - The administrator key of the cluster, which may be obtained from an existing ceph monitor by ceph auth get client.admin -o /tmp/ceph.client.admin.keyring

  • ceph.mon.keyring - The monitor key, which may be obtained from an existinv ceph monitor by ceph auth get mon. -o /tmp/ceph.mon.keyring

  • monmap - The present monitor map of the cluster, which may be obtained from an existing ceph monitor by ceph mon getmap -o /tmp/monmap

为compute节点添加mon

  • 登录compute

ssh root@compute
  • 删除/etc/ceph/monnap

rm -rf /etc/ceph/monmap
  • 获取monmap

ceph mon getmap -o /etc/ceph/monmap
  • 创建mon

docker run -d \
       --name mon1 \
       -e MON_IP=10.64.0.53 \
       -e MON_NAME=mon1 \
       --net=host \
       -v /etc/ceph:/etc/ceph \
       -v /opt/mon1:/var/lib/ceph \
       ceph/mon:hammer

查看ceph状态

ceph -s
    cluster 4ae8b795-a8b2-4904-9573-f6f658838db3
     health HEALTH_WARN
            clock skew detected on mon.mon1
     monmap e2: 2 mons at {mon0=10.64.0.4:6789/0,mon1=10.64.0.53:6789/0}
            election epoch 2, quorum 0,1 mon0,mon1
     osdmap e14: 3 osds: 3 up, 3 in
      pgmap v27: 64 pgs, 1 pools, 0 bytes data, 0 objects
            15459 MB used, 319 GB / 334 GB avail
                  64 active+clean