Ceph中查找BUCKET INDEX所在位置的方法

##1.引言 本文说明了如何查看每个BUCKET对应的索引信息,以及所在的OSD位置,为以后运维做参考。

##2.实验过程

###2.1 罗列出当前系统下所有的bucket信息

# radosgw-admin bucket list
[
    "small_rd_test_bucket",    
    "mynewtest",
    "mytest-2",
    "xuwenping-bucket-zj-4",
    "big_rd_test_bucket",
    "mytest",
    "my-scs-test",
    "write_test_bucket",
]

上述命令展示了当前Ceph 对象存储系统中涉及到的所有的BUCKET。

###2.2 查看具体某个BUCKET属性

# radosgw-admin bucket stats --bucket=my-scs-test
{
    "bucket": "my-scs-test",
    "pool": ".rgw.buckets.zj-1",
    "index_pool": ".rgw.buckets.index",
    "id": "default.784974.1",
    "marker": "default.784974.1",
    "owner": "zj-user-1",
    "ver": "0#1901",
    "master_ver": "0#0",
    "mtime": "2016-01-07 00:00:23.000000",
    "max_marker": "0#",
    "usage": {
        "rgw.main": {
            "size_kb": 1048870,
            "size_kb_actual": 1048908,
            "num_objects": 17
        }
    },
    "bucket_quota": {
        "enabled": false,
        "max_size_kb": -1,
        "max_objects": -1
    }
}

该命令展示了BUCKET的名称,所在的data pool, index pool. BUCKET ID.

2.3 检查对应BUCKET在index中是否存在

# rados -p .rgw.buckets.index ls - | grep "default.784974.1"
.dir.default.784974.1

注:此处需要在BUCKET ID前面加上.dir. 才是它在INDEX POOL中的索引

###2.4 查看对应INDEX中记录的key

# rados -p .rgw.buckets.index listomapkeys .dir.default.784974.1
/home/.TempWrite.py.swp
/home/1024
/home/TempWrite.py
/home/crossdomain.xml
/home/download_url.txt
/home/region.conf.json
/home/region.conf.json.bk
/home/result
/home/s3Test.cpp
/home/s3testInMemory
/home/struct_def.h
/home/user.md.json
/home/user1.md.json
/home/user2.md.json
/home/user3.md.json
/home/user4.md.json
/home/zone.conf.json

统计文件数量

rados -p .rgw.buckets.index listomapkeys  .dir.default.104766.19 | wc -l
988847

###2.5 查看对应索引信息存放的物理位置

# ceph osd map .rgw.buckets.index   .dir.default.104766.19
osdmap e34039 pool '.rgw.buckets.index' (23) object '.dir.default.104766.19' -> pg 23.e3579e34 (23.34) -> up ([3,16,34], p3) acting ([3,16,34], p3)

通过命令可以看到,BUCKET my-scs-test 的index信息落在OSD 3,16,34上面,其中3为主osd.

##参考: 所有实验过程参考该文章而写

转载于:https://my.oschina.net/myspaceNUAA/blog/619300

你可能感兴趣的:(Ceph中查找BUCKET INDEX所在位置的方法)