zoukankan      html  css  js  c++  java
  • ceph 创建使用 rbd

    # 查看 osd 池
    ceph osd lspools
    
    # 创建 pool 池, pool osd pool create <pool> [<pg_num:int>] [<pgp_num:int>]
    ceph osd pool create ceph-demo 64 64
    
    ceph osd lspools
    
    # 查看 pool pg 数量
    ceph osd pool get ceph-demo pg_num
    
    # 查看 pool pgp 数量
    ceph osd pool get ceph-demo pgp_num
    
    # 查看 pool 的副本数
    ceph osd pool get ceph-demo size
    
    # 查看 pool 的存储规则
    ceph osd pool get ceph-demo crush_rule
    
    # 调整 pool pg 数量
    ceph osd pool set ceph-demo pg_num 128
    
    # 查看 ceph 集群状态
    ceph -s
    
    # 创建块设备镜像
    rbd create -p ceph-demo --image rbd-demo.img --size 5G
    rbd create ceph-demo/rbd-demo-1.img --size 5G
    
    # 查看 ceph-demo 池中的块设备
    rbd -p ceph-demo ls
    
    # 查看镜像信息
    rbd info ceph-demo/rbd-demo.img
    rbd -p ceph-demo info rbd-demo.img
    
    # 映射块设备
    rbd map ceph-demo/rbd-demo.img
    
    dmesg |tail
    rbd -p ceph-demo info rbd-demo.img
    
    # 因为操作系统内核无法支持某些特性,所以禁用掉
    rbd feature disable ceph-demo/rbd-demo.img deep-flatten
    rbd feature disable ceph-demo/rbd-demo.img fast-diff
    rbd feature disable ceph-demo/rbd-demo.img exclusive-lock
    rbd map ceph-demo/rbd-demo.img
    
    # 查看映射的块存储
    rbd device list
    
    # 格式化块设备进行挂载
    mkfs.xfs /dev/rbd0 
    mkdir /mnt/rbd-demo
    mount /dev/rbd0 /mnt/rbd-demo/
    
    # 测试写入数据
    cd /mnt/rbd-demo/
    echo test > test.txt
    
    # 对镜像进行扩容
    rbd resize ceph-demo/rbd-demo.img --size 6G
    rbd -p ceph-demo info --image rbd-demo.img
    
    xfs_growfs /dev/rbd0 
    
    # 查看镜像信息
    rbd -p ceph-demo info rbd-demo.img
    
    # 列出 ceph-demo 资源池对象
    rados -p ceph-demo ls 
    rados -p ceph-demo ls |grep  rbd_data.85e3642a0138
    
    # 统计这个对象
    rados -p ceph-demo stat rbd_data.85e3642a0138.000000000000031b
    
    # 查看osd物理存储位置
    ceph osd map ceph-demo rbd_data.85e3642a0138.000000000000031b
    
    # 把 OSD 运行图转储为树,每个 OSD 一行、包含权重和状态。
    ceph osd tree
    for i in `rados -p ceph-demo ls |grep rbd_data.85e3642a0138`; do ceph osd map ceph-demo ${i};done
    
    # 显示集群健康状况
    ceph health detail
    
    # 查看池的应用类型
    ceph osd pool application get ceph-demo
    
    # 列出所有的crash 的时间戳和id,并存档crash 信息
    ceph crash ls
    
    # 为池关联应用类型,显式指定能够使用它的ceph应用类型:ceph块设备,ceph对象网关,ceph文件系统
    ceph osd pool application enable ceph-demo rbd
    
    systemctl status ceph-mgr@node-1
    systemctl status ceph-mgr@node-2
    systemctl status ceph-mgr@node-3
    

    参考:http://docs.ceph.org.cn/

  • 相关阅读:
    修改ubuntu DNS的步骤/wget url报错: unable to resolve host address的解决方法
    MySQL5.7 Replication主从复制配置教程
    总结一下安装linux系统经验-版本选择-安装ubuntu
    分布式与集群的联系与区别
    spring 后置处理器BeanFactoryPostProcessor和BeanPostProcessor的用法和区别
    mysql几种性能测试的工具使用
    mysql max_allowed_packet查询和修改
    mysql主从复制(超简单)
    10 个免费的网络监控工具(转)
    DOS批处理中%cd%和%~dp0的区别
  • 原文地址:https://www.cnblogs.com/klvchen/p/14749035.html
Copyright © 2011-2022 走看看