• 注册送彩金38元 注册送彩金38元【唯一授权官网】】】】】

  • 发布时间:2016-01-20 20:49 | 作者:yc | 来源:互联网 | 浏览:1200 次
  • 注册送彩金38元 注册送彩金38元【唯一授权官网】】】】】

    [root@os-node101 ~]# rbd snap unprotect volumes/volume-d-16ef-4814-8a2c-3fbd85e928e4@snapshot-ee7862aa-825e-4004-9587-879d60430a12

    [root@os-node101 ~]# rbd snap rm volumes/volume-d-16ef-4814-8a2c-3fbd85e928e4@snapshot-ee7862aa-825e-4004-9587-879d60430a12

    (9)删去一个镜像文件的统统快照

    [root@os-node101 ~]# rbd snap purge-p volumes volume-d-16ef-4814-8a2c-3fbd85e928e4

    Removing all snapshots: 100% complete...done.

    (10)、把ceph pool中的一个镜像导出

    导出镜像

    [root@node-44 ~]# rbd export -p images --image 74cb427c-cee9-47d0-b467-af217a67e60a /root/aaa.img

    2014-05-24 17:16:15. 7ffb47a9a7000 -- :/ >> 10.49.101.9:6789/0 pipe(0x sd=3 :0 s=1 pgs=0 cs=0 l=1 c=0x).fault

    Exporting image: 100% complete...done.

    导出云硬盘

    [root@node-44 ~]# rbd export -p volumes --image volume-470fee37-b950-4eef-a595-d7def334a5d6 /var/lib/glance/ceph-pool/volumes/Message-JiaoBenJi-10.40.212.24

    2014-05-24 17:28:18. 7f14ad39f7000 -- :/ >> 10.49.101.9:6789/0 pipe(0x260a400 sd=3 :0 s=1 pgs=0 cs=0 l=1 c=0x260a660).fault

    Exporting image: 100% complete...done.

    (11)、把一个镜像导入ceph中 (可是直接导入是不能用的,因为没有经由过程openstack,openstack是看不到的)

    [root@node-44 ~]# rbd import /root/aaa.img -p images --image 74cb427c-cee9-47d0-b467-af217a67e60a

    Importing image: 100% complete...done.

    八、ceph crush规矩

    1、把ceph的crush map导出并转换为文本款式

    #ceph osd getcrushmap -o test

    #crushtool -d test -o test1

    上面两条指令的讲解:先把crush map以二进制的要领导入到test文本,再用crushtool器械把test里的二进制数据转换成文本要领保存到test1文档里

    一、集群

    1、发动一个ceph 进程

    发动mon进程

    service ceph startmon.node1

    发动msd进程

    service ceph start mds.node1

    发动osd进程

    service ceph start osd.0

    2、反省机械的监控状况

    [root@client ~]# ceph health

    HEALTH_OK

    3、反省ceph的实时运转状况

    [root@client ~]# ceph -w

    cluster be1756f2-54f7-4d8f-8790-820c82721f17

    health HEALTH_OK

    monmap e2: 3 mons at {node1=10.240.240.211:6789/0,node2=10.240.240.212:6789/0,node3=10.240.240.213:6789/0}, election epoch 294, quorum 0,1,2 node1,node2,node3

    mdsmap e95: 1/1/1 up {0=node2=up:active}, 1 up:standby

    osdmap e88: 3 osds: 3 up, 3 in

    pgmap v1164: 448 pgs, 4 pools, 10003 MB data, 2520 objects

    23617 MB used, 37792 MB / 61410 MB avail

    448 active+clean

    2014-06-30 00:48:28. mon.0 [INF] pgmap v1163: 448 pgs: 448 active+clean; 10003 MB data, 23617 MB used, 37792 MB / 61410 MB avail

    4、反省信息状况信息

    [root@client ~]# ceph -s

    cluster be1756f2-54f7-4d8f-8790-820c82721f17

    health HEALTH_OK

    monmap e2: 3 mons at {node1=10.240.240.211:6789/0,node2=10.240.240.212:6789/0,node3=10.240.240.213:6789/0}, election epoch 294, quorum 0,1,2 node1,node2,node3

    mdsmap e95: 1/1/1 up {0=node2=up:active}, 1 up:standby

    osdmap e88: 3 osds: 3 up, 3 in

    pgmap v1164: 448 pgs, 4 pools, 10003 MB data, 2520 objects

    23617 MB used, 37792 MB / 61410 MB avail

    448 active+clean

    [root@client ~]#

    5、反省ceph存储空间

    [root@client ~]# ceph df

    GLOBAL:

    SIZEAVAILRAW USED%RAW USED

    61410M37792M23617M38.46

    POOLS:

    NAMEIDUSED%USEDOBJECTS

    dataM16.

    metadata13354k020

    rbd2000

    jiayuan3000

    [root@client ~]#

    6、删去一个节点的统统的ceph数据包

    [root@node1 ~]# ceph-deploy purge node1

    [root@node1 ~]# ceph-deploy purgedata node1

    7、为ceph创立一个admin用户并为admin用户创立一个密钥,把密钥保存到/etc/ceph目录下:

    ceph auth get-or-create client.admin mds 'allow' osd 'allow *' mon 'allow *' > /etc/ceph/ceph.client.admin.keyring

    ceph auth get-or-create client.admin mds 'allow' osd 'allow *' mon 'allow *' -o /etc/ceph/ceph.client.admin.keyring

    8、为osd.0创立一个用户并创立一个key

    ceph auth get-or-create osd.0 mon 'allow rwx' osd 'allow *' -o /var/lib/ceph/osd/ceph-0/keyring

    9、为mds.node1创立一个用户并创立一个key

    ceph auth get-or-create mds.node1 mon 'allow rwx' osd 'allow *' mds 'allow *' -o /var/lib/ceph/mds/ceph-node1/keyring

    10、反省ceph集群中的认证用户及有关的key

    ceph auth list

    11、删去集群中的一个认证用户

    ceph auth del osd.0

    12、反省集群的详细设置设备摆设

    [root@node1 ~]# ceph daemon mon.node1 config show | more

    13、反省集群康健状况细节

    [root@admin ~]# ceph health detail

    HEALTH_WARN 12 pgs down; 12 pgs peering; 12 pgs stuck inactive; 12 pgs stuck unclean

    pg 3.3b is stuck inactive since forever, current state down+peering, last acting [1,2]

    pg 3.36 is stuck inactive since forever, current state down+peering, last acting [1,2]

    pg 3.79 is stuck inactive since forever, current state down+peering, last acting [1,0]

    pg 3.5 is stuck inactive since forever, current state down+peering, last acting [1,2]

    pg 3.30 is stuck inactive since forever, current state down+peering, last acting [1,2]

    pg 3.1a is stuck inactive since forever, current state down+peering, last acting [1,0]

    pg 3.2d is stuck inactive since forever, current state down+peering, last acting [1,0]

    pg 3.16 is stuck inactive since forever, current state down+peering, last acting [1,2]

    14、反省ceph log日志地点的目录

    [root@node1 ~]# ceph-conf --name mon.node1 --show-config-value log_file

    /var/log/ceph/ceph-mon.node1.log

    二、mon

    1、反省mon的状况信息

    [root@client ~]# ceph mon stat

    e2: 3 mons at {node1=10.240.240.211:6789/0,node2=10.240.240.212:6789/0,node3=10.240.240.213:6789/0}, election epoch 294, quorum 0,1,2 node1,node2,node3

    2、反省mon的推举状况

    [root@client ~]# ceph quorum_status

    {"election_epoch":294,"quorum":[0,1,2],"quorum_names":["node1","node2","node3"],"quorum_leader_name":"node1","monmap":{"epoch":2,"fsid":"be1756f2-54f7-4d8f-8790-820c82721f17","modified":"2014-06-26 18:43:51.","created":"0.","mons":[{"rank":0,"name":"node1","addr":"10.240.240.211:6789\/0"},{"rank":1,"name":"node2","addr":"10.240.240.212:6789\/0"},{"rank":2,"name":"node3","addr":"10.240.240.213:6789\/0"}]}}

    3、反省mon的映射信息

    [root@client ~]# ceph mon dump

    dumped monmap epoch 2

    epoch 2

    fsid be1756f2-54f7-4d8f-8790-820c82721f17

    last_changed 2014-06-26 18:43:51.

    created 0.

    0: 10.240.240.211:6789/0 mon.node1

    1: 10.240.240.212:6789/0 mon.node2

    2: 10.240.240.213:6789/0 mon.node3

    4、删去一个mon节点

    [root@node1 ~]# ceph mon remove node1

    removed mon.node1 at 10.39.101.1:6789/0, there are now 3 monitors

    2014-07-07 18:11:04. 7f4d16bfd7000 monclient: hunting for new mon

    5、取得一个正在运转的mon map,并保存在1.txt文件中

    [root@node3 ~]# ceph mon getmap -o 1.txt

    got monmap epoch 6

    6、反省上面取得的map

    [root@node3 ~]#monmaptool --print 1.txt

    monmaptool: monmap file 1.txt

    epoch 6

    fsid -a0a8-41b8-8b45-c93ae

    last_changed 2014-07-07 18:22:51.

    created 0.

    0: 10.39.101.1:6789/0 mon.node1

    1: 10.39.101.2:6789/0 mon.node2

    2: 10.39.101.3:6789/0 mon.node3

    [root@node3 ~]#

    7、把上面的mon map写入新参加的节点

    ceph-mon -i node4 --inject-monmap 1.txt

    8、反省mon的amin socket

    root@node1 ~]# ceph-conf --name mon.node1 --show-config-value admin_socket

    /var/run/ceph/ceph-mon.node1.asok

    9、反省mon的详细状况

    [root@node1 ~]# ceph daemon mon.node1mon_status

    { "name": "node1",

    "rank": 0,

    "state": "leader",

    "election_epoch": 96,

    "quorum": [

    0,

    1,

    2],

    "outside_quorum": [],

    "extra_probe_peers": [

    "10.39.101.4:6789\/0"],

    "sync_provider": [],

    "monmap": { "epoch": 6,

    "fsid": "-a0a8-41b8-8b45-c93ae",

    "modified": "2014-07-07 18:22:51.",

    "created": "0.",

    "mons": [

    { "rank": 0,

    "name": "node1",

    "addr": "10.39.101.1:6789\/0"},

    { "rank": 1,

    "name": "node2",

    "addr": "10.39.101.2:6789\/0"},

    { "rank": 2,

    "name": "node3",

    "addr": "10.39.101.3:6789\/0"}]}

    10、删去一个mon节点

    [root@os-node1 ~]# ceph mon remove os-node1

    removed mon.os-node1 at 10.40.10.64:6789/0, there are now 3 monitors

    三、msd

    1、反省msd状况

    [root@client ~]# ceph mds stat

    e95: 1/1/1 up {0=node2=up:active}, 1 up:standby

    2、反省msd的映射信息

    [root@client ~]# ceph mds dump

    dumped mdsmap epoch 95

    epoch95

    flags0

    created 2014-06-26 18:41:57.

    modified2014-06-30 00:24:11.

    tableserver0

    root0

    session_timeout 60

    session_autoclose300

    max_file_size776

    last_failure84

    last_failure_osd_epoch81

    compatcompat={},rocompat={},incompat={1=base v0.20,2=client writeable ranges,3=default file layouts on dirs,4=dir inode in separate object,5=mds uses versioned encoding,6=dirfrag is stored in omap}

    max_mds 1

    in0

    up{0=5015}

    failed

    stopped

    data_pools0

    metadata_pool1

    inline_datadisabled

    5015:10.240.240.212:6808/3032 'node2' mds.0.12 up:active seq 30

    5012:10.240.240.211:6807/3459 'node1' mds.-1.0 up:standby seq 38

    3、删去一个mds节点

    [root@node1 ~]# cephmds rm 0 mds.node1

    mds gid 0 dne

    4、设置cephfs文件体系存储措施最大年夜单个文件尺度

    [root@node1 ~]#ceph mds set max_file_size 000

    四、osd

    1、反省ceph osd运转状况

    [root@client ~]# ceph osd stat

    osdmap e88: 3 osds: 3 up, 3 in

    2、反省osd映射信息

    [root@client ~]# ceph osd dump

    epoch 88

    fsid be1756f2-54f7-4d8f-8790-820c82721f17

    created 2014-06-26 18:41:57.

    modified 2014-06-30 00:46:27.

    flags

    pool 0 'data' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 1 owner 0 flags hashpspool crash_replay_interval 45 stripe_width 0

    pool 1 'metadata' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 1 owner 0 flags hashpspool stripe_width 0

    pool 2 'rbd' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 1 owner 0 flags hashpspool stripe_width 0

    pool 3 'jiayuan' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 256 pgp_num 256 last_change 73 owner 0 flags hashpspool stripe_width 0

    max_osd 3

    osd.0 upinweight 1 up_from 65 up_thru 75 down_at 64 last_clean_interval [53,55) 10.240.240.211:6800/3089 10.240.240.211:6801/3089 10.240.240.211:6802/3089 10.240.240.211:6803/3089 exists,up 8a24ad16-a483-4bac-a56a-6ed44ab74ff0

    osd.1 upinweight 1 up_from 59 up_首充一元送18元彩金thru 74 down_at 58 last_clean_interval [31,55) 10.240.240.212:6800/2696 10.240.240.212:6801/2696 10.240.240.212:6802/2696 10.240.240.212:6803/2696 exists,up 8619c083-0273-4203-ba57-4b1dabb89339

    osd.2 upinweight 1 up_from 62 up_thru 74 down_at 61 last_clean_interval [39,55) 10.240.240.213:6800/2662 10.240.240.213:6801/2662 10.240.240.213:6802/2662 10.240.240.213:6803/2662 exists,up f8107c04-35d7-4fb8-8c82-09eb885f0e58

    [root@client ~]#

    3、反省osd的目录树

    [root@client ~]# ceph osd tree

    # idweighttype nameup/down reweight

    -13root default

    -21host node1

    01osd.0up1

    -31host node2

    11osd.1up1

    -41host node3

    21osd.2up1

    4、down掉落一个osd硬盘

    [root@node1 ~]# ceph osd down 0#down掉落osd.0节点

    5、在集群中删去一个osd硬盘

    [root@node4 ~]# ceph osd rm 0

    removed osd.0

    6、在集群中删去一个osd 硬盘 crush map

    [root@node1 ~]# ceph osd crush rm osd.0

    7、在集群中删去一个osd的host节点

    [root@node1 ~]# ceph osd crush rm node1

    removed item id -2 name 'node1' from crush map

    反省最大年夜osd的个数

    [root@node1 ~]# ceph osd getmaxosd

    max_osd = 4 in epoch 514#默许最大年夜是4个osd节点

    8、设置最大年夜的osd的个数(当扩展osd节点的时分有需要扩展这个值)

    [root@node1 ~]# ceph osd setmaxosd 10

    9、设置osd crush的权重为1.0

    ceph osd crush set {id} {weight} [{loc1} [{loc2} ...]]

    例如:

    [root@admin ~]# ceph osd crush set 3 3.0 host=node4

    set item id 3 name 'osd.3' weight 3 at location {host=node4} to crush map

    [root@admin ~]# ceph osd tree

    # idweighttype nameup/down reweight

    -16root default

    -21host node1

    01osd.0up1

    -31host node2

    11osd.1up1

    -41host node3

    21osd.2up1

    -53host node4

    33osd.3up0.5

    或许用下面的措施

    [root@admin ~]# ceph osd crush reweight osd.3 1.0

    reweighted item id 3 name 'osd.3' to 1 in crush map

    [root@admin ~]# ceph osd tree

    # idweighttype nameup/down reweight

    -14root default

    -21host node1

    01osd.0up1

    -31host node2

    11osd.1up1

    -41host node3

    21osd.2up1

    -51host node4

    31osd.3up0.5

    10、设置osd的权重

    [root@admin ~]# ceph osd reweight 3 0.5

    reweighted osd.3 to 0.5 ()

    [root@admin ~]# ceph osd tree

    # idweighttype nameup/down reweight

    -14root default

    -21host node1

    01osd.0up1

    -31host node2

    11osd.1up1

    -41host node3

    21osd.2up1

    -51host node4

    31osd.3up0.5

    11、把一个osd节点逐出集群

    [root@admin ~]# ceph osd out osd.3

    marked out osd.3.

    [root@admin ~]# ceph osd tree

    # idweighttype nameup/down reweight

    -14root default

    -21host node1

    01osd.0up1

    -31host node2

    11osd.1up1

    -41host node3

    21osd.2up1

    -51host node4

    31osd.3up0# osd.3的reweight变为0了就不再分配数据,可是设备仍是存活的

    12、把逐出的osd参加集群

    [root@admin ~]# ceph osd in osd.3

    marked in osd.3.

    [root@admin ~]# ceph osd tree

    # idweighttype nameup/down reweight

    -14root default

    -21host node1

    01osd.0up1

    -31host node2

    11osd.1up1

    -41host node3

    21osd.2up1

    -51host node4

    31osd.3up1

    13、停息osd (停息后整个集群不再回收数据)

    [root@admin ~]# ceph osd pause

    set pauserd,pausewr

    14、再次洞开osd (洞开后再次回收数据)

    [root@admin ~]# ceph osd unpause

    unset pauserd,pausewr

    15、反省一个集群osd.2参数的设置设备摆设

    ceph --admin-daemon /var/run/ceph/ceph-osd.2.asok config show | less

    五、PG组

    1、1、反省pg组的映射信息

    [root@client ~]# ceph pg dump

    dumped all in format plain

    version 1164

    stamp 2014-06-30 00:48:29.

    last_osdmap_epoch 88

    last_pg_scan 73

    full_ratio 0.95

    nearfull_ratio 0.85

    pg_stat objects mipdegrunfbyteslogdisklog statestate_stampvreportedupup_primaryactingacting_primarylast_scrubscrub_stamplast_deep_scrudeep_scrub_stamp

    0.3factive+clean2014-06-30 00:30:59.'12888:242[0,2]0[0,2]044'-06-29 22:25:25.'02014-06-26 19:52:08.

    3.3cactive+clean2014-06-30 00:15:38.'088:21[2,1]2[2,1]20'02014-06-30 00:15:04.'02014-06-30 00:15:04.

    2.3cactive+clean2014-06-30 00:10:48.'088:46[2,1]2[2,1]20'02014-06-29 22:29:13.'02014-06-26 19:52:08.

    1.3factive+clean2014-06-30 00:10:48.'288:66[2,1]2[2,1]216'22014-06-29 22:28:03.'02014-06-26 19:52:08.

    0.3eactive+clean2014-06-30 00:26:22.'13088:304[2,0]2[2,0]244'-06-29 22:26:41.'02014-06-26 19:52:08.

    3.3dactive+clean2014-06-30 00:16:57.'088:20[0,2]0[0,2]00'02014-06-30 00:15:19.'02014-06-30 00:15:19.

    2.3factive+clean2014-06-30 00:10:58.'088:106[0,2]0[0,2]00'02014-06-29 22:27:44.'02014-06-26 19:52:08.

    1.3cactive+clean2014-06-30 00:10:48.'188:66[1,2]1[1,2]116'12014-06-29 22:27:35.'02014-06-26 19:52:08.

    0.3dactive+clean2014-06-30 00:23:57.'14988:300[0,2]0[0,2]044'-06-29 22:25:24.'02014-06-26 19:52:08.

    3.3eactive+clean2014-06-30 00:15:39.'088:21[2,1]2[2,1]20'02014-06-30 00:15:04.'02014-06-30 00:15:04.

    2.3eactive+clean2014-06-30 00:10:48.'088:46[2,1]2[2,1]20'02014-06-29 22:29:14.'02014-06-26 19:52:08.

    1.3dactive+clean2014-06-30 00:10:48.'088:58[1,2]1[1,2]10'02014-06-29 22:27:36.'02014-06-26 19:52:08.

    0.3cactive+clean2014-06-30 00:24:55.'15788:385[1,0]1[1,0]144'-06-29 22:26:34.'02014-06-26 19:52:08.

    3.3factive+clean2014-06-30 00:17:08.'088:20[0,1]0[0,1]00'02014-06-30 00:15:19.'02014-06-30 00:15:19.

    2.active+clean2014-06-30 00:10:58.'088:71[2,0]2[2,0]20'02014-06-29 22:29:10.'02014-06-26 19:52:08.

    1.3aactive+clean2014-06-30 00:10:58.'088:106[0,2]0[0,2]00'02014-06-29 22:26:29.'02014-06-26 19:52:08.

    0.3bactive+clean2014-06-30 00:28:45.'13788:278[0,2]0[0,2]044'-06-29 22:25:22.'02014-06-26 19:52:08.

    3.active+clean2014-06-30 00:16:13.'088:21[1,0]1[1,0]10'02014-06-30 00:15:05.'02014-06-30 00:15:05.

    2.active+clean2014-06-30 00:10:58.'088:71[2,0]2[2,0]20'02014-06-29 22:29:06.'02014-06-26 19:52:08.

    1.3bactive+clean2014-06-30 00:10:58.'088:78[1,0]1[1,0]10'02014-06-29 22:27:30.'02014-06-26 19:52:08.

    0.3aactive+clean2014-06-30 00:28:47.'14988:288[0,2]0[0,2]044'-06-29 22:25:21.'02014-06-26 19:52:08.

    3.active+clean2014-06-30 00:16:13.'088:21[1,0]1[1,0]10'02014-06-30 00:15:05.'02014-06-30 00:15:05.

    2.3bactive+clean2014-06-30 00:10:48.'088:57[1,2]1[1,2]10'02014-06-29 22:28:35.'02014-06-26 19:52:08.

    1.active+clean2014-06-30 00:10:48.'088:46[2,1]2[2,1]20'02014-06-29 22:28:01.'02014-06-26 19:52:08.

    0.64active+clean2014-06-30 00:25:30.'16488:432[1,0]1[1,0]144'-06-29 22:26:33.'02014-06-26 19:52:08.

    下面有些省掉落

    2、反省一个PG的map

    [root@client ~]# ceph pg map 0.3f

    osdmap e88 pg 0.3f (0.3f) -> up [0,2] acting [0,2]#其间的[0,2]代表存储在osd.0、osd.2节点,osd.0代表主副本的存储方位

    3、反省PG状况

    [root@client ~]# ceph pg stat

    v1164: 448 pgs: 448 active+clean; 10003 MB data, 23617 MB used, 37792 MB / 61410 MB avail

    4、查询一个pg的详细信息

    [root@client ~]# ceph pg0.26 query

    5、反省pg中stuck的状况

    [root@client ~]# ceph pg dump_stuck unclean

    ok

    [root@client ~]# ceph pg dump_stuck inactive

    ok

    [root@client ~]# ceph pg dump_stuck stale

    ok

    6、显现一个集群中的统统的pg谋略

    ceph pg dump --format plain

    7、康复一个损掉落的pg

    ceph pg {pg-id} mark_unfound_lost revert

    8、显现非正常状况的pg

    ceph pg dump_stuck inactive|unclean|stale

    六、pool

    1、反省ceph集群中的pool数量

    [root@admin ~]# ceph osd lspools

    0 data,1 metadata,2 rbd,

    2、在ceph集群中创立一个pool

    ceph osd pool create jiayuan 100#这儿的100指的是PG组

    3、为一个ceph pool设置设备摆设配额

    ceph osd pool set-quota data max_objects 10000

    4、在集群中删去一个pool

    ceph osd pool delete jiayuanjiayuan--yes-i-really-really-mean-it#集群姓名需求重复两次

    5、显现集群中pool的详细信息

    [root@admin ~]# rados df

    pool namecategoryKBobjectsclonesdegradedunfoundrdrd KBwrwr KB

    data-64704

    metadata-

    rbd-

    total used16176

    total avail

    total space

    [root@admin ~]#

    6、给一个pool创立一个快照

    [root@admin ~]# ceph osd pool mksnap datadate-snap

    created pool data snap date-snap

    7、删去pool的快照

    [root@admin ~]# ceph osd pool rmsnap data date-snap

    removed pool data snap date-snap

    8、反省data池的pg数量

    [root@admin ~]# ceph osd pool get data pg_num

    pg_num: 64

    9、设置data池的最大年夜存储空间为100T(默许是1T)

    [root@admin ~]# ceph osd pool set data target_max_bytes 00000

    set pool 0 target_max_bytes to 00000

    10、设置data池的副本数是3

    [root@admin ~]# ceph osd pool set data size 3

    set pool 0 size to 3

    11、设置data池能遭遇写操作的最小副本为1

    [root@admin ~]# ceph osd pool set data min_size 1

    set pool 0 min_size to 1

    12、反省集群中统统pool的副本尺度

    [root@admin mycephfs]# ceph osd dump | grep 'replicated size'

    pool 0 'data' replicated size 3 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 26 owner 0 flags hashpspool crash_replay_interval 45 target_bytes 00000 stripe_width 0

    pool 1 'metadata' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 1 owner 0 flags hashpspool stripe_width 0

    pool 2 'rbd' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 1 owner 0 flags hashpspool stripe_width 0

    13、设置一个pool的pg数量

    [root@admin ~]# ceph osd pool set data pg_num 100

    set pool 0 pg_num to 100

    14、设置一个pool的pgp数量

    [root@admin ~]# ceph osd pool set data pgp_num 100

    set pool 0 pgp_num to 100

    15、设置一个池中object的巨细

    [root@B2801-ceph-0 ~]# ceph osd pool set-quota data max_objects #单位为bytes

    set-quota max_objects = for pool data

    注册送彩金38元 注册送彩金38元【唯一授权官网】】】】】

    七、rados和rbd指令

    1、rados指令应用措施

    (1)、反省ceph集群中有若干个pool (仅仅反省pool)

    [root@node-44 ~]# rados lspools

    data

    metadata

    rbd

    images

    volumes

    .rgw.root

    compute

    .rgw.control

    .rgw

    .rgw.gc

    .users.uid

    (2)、反省ceph集群中有若干个pool,而且每个pool容量及应用状况

    [root@node-44 ~]# rados df

    pool namecategoryKBobjectsclonesdegradedunfoundrdrd KBwrwr KB

    .rgw-

    .rgw.control-

    .rgw.gc-60

    .rgw.root-010

    .users.uid-

    compute-

    data-

    images-75482

    metadata-

    rbd-

    volumes-

    total used6941

    total avail0

    total space4

    [root@node-44 ~]#

    (3)、创立一个pool

    [root@node-44 ~]#rados mkpool test

    (4)、反省ceph pool中的ceph object (这儿的object因此块要领存储的)

    [root@node-44 ~]# rados ls -p volumes | more

    rbd_data.348f21ba7021.

    rbd_data.32562ae8944a.000c79

    rbd_data.589c2ae8944a.0031ba

    rbd_data.58c9151ff76b.0029af

    rbd_data.58c9151ff76b.002c19

    rbd_data.58c9151ff76b.000a5a

    rbd_data.58c9151ff76b.001c69

    rbd_data.58c9151ff76b.00281d

    rbd_data.58c9151ff76b.002de1

    rbd_data.58c9151ff76b.002dae

    (5)、创立一个目标object

    [root@admin-node ~]# rados create test-object -p test

    [root@admin-node ~]# rados -p test ls

    test-object

    (6)、删去一个目标

    [root@admin-node ~]# rados rm test-object-1 -p test

    2、rbd指令的用法

    (1)、反省ceph中一个pool里的统统镜像

    [root@node-44 ~]# rbd ls images

    2014-05-24 17:17:37. 7f14caa6e7000 -- :/ >> 10.49.101.9:6789/0 pipe(0x6c5400 sd=3 :0 s=1 pgs=0 cs=0 l=1 c=0x6c5660).fault

    2182d9ac-52f4-4f5d-99a1-ab3ceacbf0b9

    34e1a475-5b11-410c-b4c4-69b5f780f03c

    476a9f3b-4608-4ffd-90ea-8750e804f46e

    60eae8bf-dd23-40c5-ba02-266d5b

    72e16e93-1fa5-4e11-8497-15bd904eeffe

    74cb427c-cee9-47d0-b467-af217a67e60a

    8f181a53-520b-4e22-af7c-de59e8ccca78

    9867a580-22fe-4ed0-a1a8-120b8e8d18f4

    ac6f4dae-4b81-476d-9e83-ad92ff25fb13

    d20206d7-ff31-4dce-b59a-a622b0ea3af6

    [root@node-44 ~]# rbd ls volumes

    2014-05-24 17:22:18. 7f9e -- :/ >> 10.49.101.9:6789/0 pipe(0x96a400 sd=3 :0 s=1 pgs=0 cs=0 l=1 c=0x96a660).fault

    volume-0788fc6c-0dd4-4339-bad4-e9d78bd5365c

    volume-0898c5b大发888网页版登陆4-4072-4cae-affc-ec59c2375c51

    volume-2a1fb287-5666-4095-8f0b-e2

    volume-35c6aad4-8ea4-4b8d-95c7-7c3a8e8758c5

    volume-cc-5ae6-4094-9d06-d844fdf485c4

    volume-8a6fb0db-35a9-4b3b-9ace-fb647c2918ea

    volume-8c-9b03-4308-b979-51378bba2ed1

    volume-8cf3d206-2cce-4579-91c5-77bcb4a8a3f8

    注册送彩金38元 注册送彩金38元【唯一授权官网】】】】】volume-91fc075c-8bd1-41dc-b5ef-844f23df177d

    volume-b1263d8b-0a12-4b51-84e5-74434c0e73aa

    volume-b84fad5d-16ee-4343-8630-88ffeb

    volume-c03a2eb1-06a3-4d79-98e5-7cc3

    volume-c17bf6c0-80ba-47d9-862d-1b9e9a48231e

    volume-c32bca55-7ec0-47ce-a87e-a883da4b4ccd

    volume-df8961ef-11d6-4dae-96ee-f2df8eb4a08c

    volume-f1c38695-81f8-44fd-9af0-458cddf103a3

    (2)、反省ceph pool中一个镜像的信息

    [root@node-44 ~]# rbd info -p images --image 74cb427c-cee9-47d0-b467-af217a67e60a

    rbd image '74cb427c-cee9-47d0-b467-af217a67e60a':

    size 1048 MB in 131 objects

    order 23 (8192 KB objects)

    block_name_prefix: rbd_data.95c7783fc0d0

    format: 2

    features: layering

    (3)、在test池中创立一个命名为zhanguo的10000M的镜像

    [root@node-44 ~]# rbd create -p test --size 10000 zhanguo

    [root@node-44 ~]# rbd -p test info zhanguo#反省新建的镜像的信息

    rbd image 'zhanguo':

    size 10000 MB in 2500 objects

    order 22 (4096 KB objects)

    block_name_prefix: rb.0.127d2.2ae8944a

    format: 1

    [root@node-44 ~]#

    (4)、删去一个镜像

    [root@node-44 ~]# rbd rm-p testlizhanguo

    Removing image: 100% complete...done.

    (5)、调剂一个镜像的尺度

    [root@node-44 ~]# rbd resize -p test --size 20000 zhanguo

    Resizing image: 100% complete...done.

    [root@node-44 ~]# rbd -p test info zhanguo#调剂后的镜像巨细

    rbd image 'zhanguo':

    size 20000 MB in 5000 objects

    order 22 (4096 KB objects)

    block_name_prefix: rb.0.127d2.2ae8944a

    format: 1

    [root@node-44 ~]#

    (6)、给一个镜像创立一个快照

    [root@node-44 ~]# rbdsnap createtest/zhanguo@zhanguo123#池/镜像@快照

    [root@node-44 ~]# rbdsnap ls-p test zhanguo

    SNAPID NAMESIZE

    2 zhanguo123 20000 MB

    [root@node-44 ~]#

    [root@node-44 ~]# rbd info test/zhanguo@zhanguo123

    rbd image 'zhanguo':

    size 20000 MB in 5000 objects

    order 22 (4096 KB objects)

    block_name_prefix: rb.0.127d2.2ae8944a

    format: 1

    protected: False

    [root@node-44 ~]#

    (7)、反省一个镜像文件的快照

    [root@os-node101 ~]# rbd snap ls-p volumes volume-d-16ef-4814-8a2c-3fbd85e928e4

    SNAPID NAMESIZE

    5 snapshot-ee7862aa-825e-4004-9587-879d60430a12 MB

    (8)、删去一个镜像文件的一个快照快照

    快照地点的池/快照地点的镜像文件@ 快照

    [root@os-node101 ~]# rbd snap rm volumes/volume-d-16ef-4814-8a2c-3fbd85e928e4@snapshot-ee7862aa-825e-4004-9587-879d60430a12

    rbd: snapshot 'snapshot-60586eba-b0be-4885-81ab-e50efb' is protected from removal.

    2014-08-18 19:23:42. 7fd0245ef760 -1 librbd: removing snapshot from header failed: (16) Device or resource busy

    上面不能删去显现的报错信息是此快照备写保护了,下面指令是删去写保护后再进行删去

    2、把从头写的ceph crush导入ceph集群

    #crushtool -c test1 -o test2#把test1 转换成二进制要领

    #ceph osd setcrushmap -i test2#把test2导入集群

    这篇文章出自 “zhangdh洞开空间” 博客,请必须保存此出处http://linuxblind.blog.51cto.com//

  • 相关内容

友情链接: