ceph命令入门

当前环境是三个节点,每个节点是100G,总计300G。

ceph df

查看ceph存储空间

ceph df 
GLOBAL:
    SIZE     AVAIL     RAW USED     %RAW USED 
    299G      293G        6053M          1.97 
POOLS:
    NAME          ID     USED      %USED     MAX AVAIL     OBJECTS 
    tenx-pool     1      1652M      1.09          146G         730 

由于是2个副本,可以看到pool的大学是146G空间了。
当然也可以看到每个osd。

ceph osd df

 ceph osd  df 
ID WEIGHT  REWEIGHT SIZE    USE   AVAIL   %USE VAR  
 0 0.09999  1.00000 102349M 1996M 100352M 1.95 0.99 
 1 0.09999  1.00000 102349M 1953M 100395M 1.91 0.97 
 2 0.09999  1.00000 102349M 2098M 100250M 2.05 1.04 
              TOTAL    299G 6049M    293G 1.97      
MIN/MAX VAR: 0.97/1.04  STDDEV: 0.06

ceph mon stat

查看mon的状态信息,当前有3个mons

 ceph mon stat
e1: 3 mons at {test-slave-114=10.39.0.114:6789/0,test-slave-115=10.39.0.115:6789/0,test-slave-116=10.39.0.116:6789/0}, election epoch 52, quorum 0,1,2 test-slave-114,test-slave-115,test-slave-116

ceph mds stat

查看msd状态

ceph mds stat 
e1: 0/0/0 up

ceph osd stat

查看osd状态,当前有3个osd

 ceph osd stat
osdmap e76: 3 osds: 3 up, 3 in

ceph pg stat

查看pg状态,当前有256个pg

ceph pg stat
v228829: 256 pgs: 256 active+clean; 1561 MB data, 5934 MB used, 294 GB / 299 GB avail; 862 kB/s rd, 19888 B/s wr, 59 op/s

ceph osd lspools

查看ceph集群中的pool数量

ceph osd lspools
1 tenx-pool,

查看了集群的基本情况,再看看集群里面详细的情况

ceph mon dump

查看你ceph映射信息

 ceph mon dump
dumped monmap epoch 1
epoch 1
fsid d32867dd-6602-46b0-8b56-690e2ad4a691
last_changed 0.000000
created 0.000000
0: 10.39.0.114:6789/0 mon.test-slave-114
1: 10.39.0.115:6789/0 mon.test-slave-115
2: 10.39.0.116:6789/0 mon.test-slave-116

ceph osd dump

osd的映射信息

epoch 76
fsid d32867dd-6602-46b0-8b56-690e2ad4a691
created 2017-05-24 14:05:27.666718
modified 2017-06-07 10:18:56.681512
flags 
pool 1 'tenx-pool' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 256 pgp_num 256 last_change 11 flags hashpspool stripe_width 0
    removed_snaps [1~3]
max_osd 3
osd.0 up   in  weight 1 up_from 17 up_thru 72 down_at 12 last_clean_interval [5,11) 10.39.0.116:6800/833959 10.39.0.116:6801/833959 10.39.0.116:6802/833959 10.39.0.116:6803/833959 exists,up 9a51164c-1672-484e-bfed-ae21b9d82a7a
osd.1 up   in  weight 1 up_from 15 up_thru 72 down_at 12 last_clean_interval [6,11) 10.39.0.114:6800/1995 10.39.0.114:6801/1995 10.39.0.114:6802/1995 10.39.0.114:6803/1995 exists,up ee83b7dc-7ee9-4d68-8ed7-e5d3977d71b3
osd.2 up   in  weight 1 up_from 72 up_thru 72 down_at 70 last_clean_interval [66,69) 10.39.0.115:6800/840585 10.39.0.115:6801/840585 10.39.0.115:6802/840585 10.39.0.115:6803/840585 exists,up 10cc81e9-ee85-4a92-8786-b969c3de4053
blacklist 10.39.0.114:0/776717786 expires 2017-06-07 11:18:56.299106
blacklist 10.39.0.115:0/1275196039 expires 2017-06-07 10:51:15.570556
blacklist 10.39.0.114:0/3952042303 expires 2017-06-07 11:18:54.370446

ceph pg dump

查看pg组的映射信息,由于有256个pg,下面截取部分

ceph pg dump
...
1.3d    3   0   0   0   0   12582912    64  64  active+clean    2017-06-07 06:52:43.813341  76'64   76:147  [1,2]   1   [1,2]   1   73'62   2017-06-07 06:52:43.813276  21'43   2017-05-31 22:44:23.630743
1.3a    1   0   0   0   0   4194304 40  40  active+clean    2017-06-07 06:52:26.400049  34'40   75:117  [0,2]   0   [0,2]   0   34'40   2017-06-07 06:52:26.399962  25'39   2017-05-31 16:56:10.445308
1.3b    0   0   0   0   0   0   25  25  active+clean    2017-06-06 23:42:22.714030  30'25   75:91   [1,0]   1   [1,0]   1   30'25   2017-06-06 23:42:22.713961  30'25   2017-06-01 21:08:47.920608
1.38    2   0   0   0   0   6692864 301 301 active+clean    2017-06-06 20:15:09.177891  67'301  75:426  [2,1]   2   [2,1]   2   49'98   2017-06-05 16:44:08.549733  26'53   2017-05-31 17:17:08.468789
1.39    4   0   0   0   0   4608000 195 195 active+clean    2017-06-07 06:07:41.653606  76'195  76:219  [0,1]   0   [0,1]   0   73'159  2017-06-07 06:07:41.653540  21'39   2017-06-01 07:46:58.913861
1.36    6   0   0   0   0   12984320    176 176 active+clean    2017-06-06 20:15:09.085014  76'176  76:25099    [2,0]   2       [2,0]   2   58'37   2017-06-06 08:38:44.859617  26'23   2017-06-01 04:14:28.954632
1.37    2   0   0   0   0   4202496 2   2   active+clean    2017-06-06 20:15:09.043295  44'2    75:101  [1,2]   1   [1,2]   1   44'2    2017-06-06 04:56:05.973759  25'1    2017-06-01 09:59:17.490385
1.34    1   0   0   0   0   4194304 156 156 active+clean    2017-06-06 20:15:09.177386  76'156  76:212  [2,1]   2   [2,1]   2   58'40   2017-06-06 04:16:26.196904  26'16   2017-06-01 08:12:54.304594
1.35    5   0   0   0   0   17178624    177 177 active+clean    2017-06-06 20:15:09.084854  76'177  76:255  [2,0]   2   [2,0]   2   58'90   2017-06-05 18:22:49.940850  26'40   2017-05-31 23:06:19.545718
1.32    5   0   0   0   0   8798224 51  51  active+clean    2017-06-06 20:15:09.105826  76'51   76:206  [0,2]   0   [0,2]   0   61'49   2017-06-06 16:55:17.321631  26'32   2017-06-01 01:36:47.941264
1.33    2   0   0   0   0   8388608 100 100 active+clean    2017-06-06 20:15:09.065702  74'100  74:158  [1,2]   1   [1,2]   1   44'1    2017-06-06 12:20:29.965421  0'0 2017-06-01 15:08:44.247138
1.30    2   0   0   0   0   4202496 38  38  active+clean    2017-06-06 20:15:09.065266  28'38   75:175  [1,2]   1   [1,2]   1   28'38   2017-06-05 15:31:33.570471  26'36   2017-05-31 22:23:23.427532
1.31    2   0   0   0   0   2990080 207 207 active+clean    2017-06-07 01:14:01.487584  74'207  74:288  [0,2]   0   [0,2]   0   73'189  2017-06-07 01:14:01.487529  26'98   2017-05-31 22:15:50.965225
1.2e    3   0   0   0   0   4206592 40  40  active+clean    2017-06-06 20:15:09.076529  67'40   75:125  [2,0]   2   [2,0]   2   49'36   2017-06-06 00:13:08.877421  26'14   2017-06-01 02:39:34.576302

rbd ls {poolname} -l

列出块设备

rbd ls tenx-pool -l
NAME                                            SIZE PARENT FMT PROT LOCK 
admin.CID-0edd5db4bfd1.datadir-mysql-0          512M          2      excl 
admin.CID-ca4135da3326.block10                  512M          2           
admin.CID-ca4135da3326.gg77                     512M          2           
admin.CID-ca4135da3326.ok10                     512M          2           

创建块设备:rbd create {image-name} –size {megabytes} –pool {pool-name}
检索块信息:rbd –image {image-name} info
删除块设备:rbd rm {image-name}
查看已映射块设备:rbd showmapped
创建快照:rbd –pool {pool-name} snap create –snap {snap-name} {image-name}

你可能感兴趣的:(存储)