ceph中获取osdmap和monmap的方式

ceph集群中,可以用osdmaptool和monmaptool,来创建、获取osdmap和monmap的信息。

可以查阅官方文档:osdmaptool、monmaptool

 

一、 获取osdmap

方法一:通过ceph命令

# ceph osd dump
epoch 95
fsid ced59665-9de8-42b7-b2c3-5a19cffe97c7
created 2016-03-25 21:13:13.595390
modified 2016-03-31 12:36:39.588974
flags sortbitwise
pool 0 'rbd' replicated size 2 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 128 pgp_num 128 last_change 16 flags hashpspool stripe_width 0
pool 1 'testpool' replicated size 2 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 512 pgp_num 512 last_change 95 flags hashpspool stripe_width 0
    removed_snaps [1~3]
max_osd 6
osd.0 up   in  weight 1 up_from 77 up_thru 88 down_at 70 last_clean_interval [54,61) 10.167.225.35:6812/3979 10.167.225.35:6813/3979 10.167.225.35:6814/3979 10.167.225.35:6815/3979 exists,up 5c0194c3-351b-4ce9-9864-083819a3e0cb
osd.1 up   in  weight 1 up_from 74 up_thru 91 down_at 70 last_clean_interval [51,61) 10.167.225.35:6808/3668 10.167.225.35:6809/3668 10.167.225.35:6810/3668 10.167.225.35:6811/3668 exists,up 02327243-d1e4-4ea5-9688-9c5e6f46ec44
osd.2 up   in  weight 1 up_from 68 up_thru 89 down_at 67 last_clean_interval [57,61) 10.167.225.35:6804/3107 10.167.225.35:6805/3107 10.167.225.35:6806/3107 10.167.225.35:6807/3107 exists,up 03a50780-9924-4f66-bf5c-71fa0b37bf2f
osd.3 up   in  weight 1 up_from 63 up_thru 89 down_at 62 last_clean_interval [48,61) 10.167.225.35:6800/2728 10.167.225.35:6801/2728 10.167.225.35:6802/2728 10.167.225.35:6803/2728 exists,up edaf6eda-6683-48bd-adf3-f9c748148036
osd.4 up   in  weight 1 up_from 85 up_thru 90 down_at 80 last_clean_interval [71,84) 10.167.225.63:6804/3048 10.167.225.63:6808/1003048 10.167.225.63:6809/1003048 10.167.225.63:6810/1003048 exists,up f57ba6b1-54e9-4bfc-930f-42adbdd036fb
osd.5 up   in  weight 1 up_from 85 up_thru 91 down_at 80 last_clean_interval [65,84) 10.167.225.63:6800/2559 10.167.225.63:6805/1002559 10.167.225.63:6807/1002559 10.167.225.63:6811/1002559 exists,up 583e265c-11c1-4230-81d6-7c9a58d0f463

方法二:通过osdmaptool工具

获取osdmap的二进制文件

# sudo ceph osd getmap -o osds.map
got osdmap epoch 95

使用文本方式查看osdmap

# osdmaptool --print osds.map
osdmaptool: osdmap file 'osds.map'
epoch 95
fsid ced59665-9de8-42b7-b2c3-5a19cffe97c7
created 2016-03-25 21:13:13.595390
modified 2016-03-31 12:36:39.588974
flags sortbitwise

pool 0 'rbd' replicated size 2 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 128 pgp_num 128 last_change 16 flags hashpspool stripe_width 0
pool 1 'testpool' replicated size 2 min_size 2 crush_ruleset 0 object_hash rjenkins pg_num 512 pgp_num 512 last_change 95 flags hashpspool stripe_width 0
    removed_snaps [1~3]

max_osd 6
osd.0 up   in  weight 1 up_from 77 up_thru 88 down_at 70 last_clean_interval [54,61) 10.167.225.35:6812/3979 10.167.225.35:6813/3979 10.167.225.35:6814/3979 10.167.225.35:6815/3979 exists,up 5c0194c3-351b-4ce9-9864-083819a3e0cb
osd.1 up   in  weight 1 up_from 74 up_thru 91 down_at 70 last_clean_interval [51,61) 10.167.225.35:6808/3668 10.167.225.35:6809/3668 10.167.225.35:6810/3668 10.167.225.35:6811/3668 exists,up 02327243-d1e4-4ea5-9688-9c5e6f46ec44
osd.2 up   in  weight 1 up_from 68 up_thru 89 down_at 67 last_clean_interval [57,61) 10.167.225.35:6804/3107 10.167.225.35:6805/3107 10.167.225.35:6806/3107 10.167.225.35:6807/3107 exists,up 03a50780-9924-4f66-bf5c-71fa0b37bf2f
osd.3 up   in  weight 1 up_from 63 up_thru 89 down_at 62 last_clean_interval [48,61) 10.167.225.35:6800/2728 10.167.225.35:6801/2728 10.167.225.35:6802/2728 10.167.225.35:6803/2728 exists,up edaf6eda-6683-48bd-adf3-f9c748148036
osd.4 up   in  weight 1 up_from 85 up_thru 90 down_at 80 last_clean_interval [71,84) 10.167.225.63:6804/3048 10.167.225.63:6808/1003048 10.167.225.63:6809/1003048 10.167.225.63:6810/1003048 exists,up f57ba6b1-54e9-4bfc-930f-42adbdd036fb
osd.5 up   in  weight 1 up_from 85 up_thru 91 down_at 80 last_clean_interval [65,84) 10.167.225.63:6800/2559 10.167.225.63:6805/1002559 10.167.225.63:6807/1002559 10.167.225.63:6811/1002559 exists,up 583e265c-11c1-4230-81d6-7c9a58d0f463

 

其中(TODO)

fsid

The fsid is a unique identifier for the cluster, and stands for File System ID from the days when the Ceph Storage Cluster was principally for the Ceph Filesystem. Ceph now supports native interfaces, block devices, and object storage gateway interfaces too, so fsid is a bit of a misnomer.

 

Peering
The process of bringing all of the OSDs that store a Placement Group (PG) into agreement about the state of all of the objects (and their metadata) in that PG. Note that agreeing on the state does not mean that they all have the latest contents. 使存储在配置组里的所有OSD对配置组里的所有对象(和他们的元数据)的状态达成一致的过程。注意:状态的达成一致不表示他们都获得了最新的内容。
Acting Set
The ordered list of OSDs who are (or were as of some epoch) responsible for a particular placement group. OSD(或者一些epoch)的有序集合,这些OSD负责具体的配置组。
Up Set
The ordered list of OSDs responsible for a particular placement group for a particular epoch according to CRUSH. Normally this is the same as the Acting Set, except when the Acting Set has been explicitly overridden via pg_temp in the OSD Map.
OSD负责特定配置组为了一个根据CRUSH特定epoch的有序列表。通常这与Acting Set相同,除非在OSD映射里,Acting Set已经通过pg_temp明显地被重写了。

Current Interval or Past Interval
A sequence of OSD map epochs during which the Acting Set and Up Set for particular placement group do not change. 在特定的配置组的代理设置和UP设置不会改变的期间,OSD映射epochs的序列。
 
Primary
The member (and by convention first) of the Acting Set, that is responsible for coordination peering, and is the only OSD that will accept client-initiated writes to objects in a placement group. 代理设置的成员(并且第一按照惯例),负责协调同等操作,也是配置组里唯一的接受客户端初始写数据的OSD。
Replica
A non-primary OSD in the Acting Set for a placement group (and who has been recognized as such and activated by the primary). 配置组里非主要OSD (并且它已被确认为被主要的OSD激活)。
Stray
An OSD that is not a member of the current Acting Set, but has not yet been told that it can delete its copies of a particular placement group. 不属于当前Acting Set成员的OSD,但也不是说可以删除它的副本。
Recovery
Ensuring that copies of all of the objects in a placement group are on all of the OSDs in the Acting Set. Once Peering has been performed, the Primary can start accepting write operations, and Recovery can proceed in the background.
确保配置组里所有对象的副本都在Acting Set的所有OSD上。一旦Peering执行,主OSD开始接受写操作,恢复操作在后台进行。
 
 
PG Info
Basic metadata about the placement group’s creation epoch, the version for the most recent write to the placement group, last epoch started, last epoch clean, and the beginning of the current interval. Any inter-OSD communication about placement groups includes the PG Info, such that any OSD that knows a placement group exists (or once existed) also has a lower bound on last epoch clean or last epoch started.
配置组创建时期的基本元数据,配置组大部分最新写入版本,最后epoch开始, 最后epoch 状态为clean, 和在当前时间间隔的开始。任何inter-OSD关于配置组的通讯包含PG信息,为了让任何知道一个配置组存在的(或曾经存在的)OSD也有一个在最后 epoch状态为clean或最后一个epoch开始的下限
 
PG Log
A list of recent updates made to objects in a placement group. Note that these logs can be truncated after all OSDs in the Acting Set have acknowledged up to a certain point. 配置组里对象的最新的更新集合。注意:在Acting Set里所有OSD到达某个点后,这些日志会被截断。
Missing Set
Each OSD notes update log entries and if they imply updates to the contents of an object, adds that object to a list of needed updates. This list is called the Missing Set for that <OSD,PG>.

每个OSD说明更新日志条目,如果它们表示更新的对象的内容,增加了该对象所需的更新列表。 这个列表为了<OSD,PG>调用 Missing Set .

Authoritative History
A complete, and fully ordered set of operations that, if performed, would bring an OSD’s copy of a placement group up to date. 所有操作的有序集合,一旦完成,OSD的副本将到达最新。
Epoch
A (monotonically increasing) OSD map version number。 一个(单调递增)的OSD映射版本号
 
Last Epoch Start
The last epoch at which all nodes in the Acting Set for a particular placement group agreed on an Authoritative History. At this point, Peering is deemed to have been successful.
拥有为一个特定的配置组的代理设置里的所有节点的最后时期,这由Authoritative History所决定的。在这一点上,对等操作被视为是成功的。
 
up_thru

Before a Primary can successfully complete the Peering process, it must inform a monitor that is alive through the current OSD map Epoch by having the monitor set its up_thru in the osd map. This helps Peering ignore previous Acting Sets for which Peering never completed after certain sequences of failures, such as the second interval below:

  • acting set = [A,B]
  • acting set = [A]
  • acting set = [] very shortly after (e.g., simultaneous failure, but staggered detection)
  • acting set = [B] (B restarts, A does not)

在一个主要部分能顺利完成对等的过程之前,它必须通过现有的osd映射Epoch,由在osd映射上设置监视器的up_thru来确认一个状态为active监视器。这帮助对等操作那些先前对等操作在一系列的失败后从没完成的代理设置,例如下面的第二个时间间隔后:

  • acting set = [A,B]
  • acting set = [A]
  • acting set = [] 之后不久 (比如, 同时失效,但交错的检测等)
  • acting set = [B] (B 重启了, A没有)
Last Epoch Clean
The last Epoch at which all nodes in the Acting set for a particular placement group were completely up to date (both placement group logs and object contents). At this point, recovery is deemed to have been completed.
最后的版本号,此时配置组的代理设置里的所有节点已经完全的到达最新(配置组日志和对象内容)。此时,可以认为恢复成功完成。

 

二、获取monmap

方法一:全部通过montoolmap工具,优点是可以查看指定Monitor的monmap

(1)用montoolmap生成指定的monitors 的map,添加mon可以通过 --add参数

# monmaptool  --create  --add  mon.a 10.167.225.35:6789  --clobber monmap
monmaptool: monmap file monmap
monmaptool: generated fsid 7c2bd6f1-a32b-462c-8287-a326a46a15c6
monmaptool: writing epoch 0 to monmap (1 monitors)

(2) 使用montoolmap工具查看map

#  monmaptool --print monmap
monmaptool: monmap file monmap
epoch 0
fsid 7c2bd6f1-a32b-462c-8287-a326a46a15c6
last_changed 2016-03-31 18:35:09.778357
created 2016-03-31 18:35:09.778357
0: 10.167.225.35:6789/0 mon.mon.a

 

方法二:获取所有的monitor的信息

# ceph mon getmap -o monmap.map
got monmap epoch 1

# monmaptool --print monmap.map
monmaptool: monmap file monmap.map
epoch 1
fsid ced59665-9de8-42b7-b2c3-5a19cffe97c7
last_changed 0.000000
created 0.000000
0: 10.167.225.35:6789/0 mon.node1

 

方法三、通过“ceph mon dump”命令

# ceph mon dump
dumped monmap epoch 1
epoch 1
fsid ced59665-9de8-42b7-b2c3-5a19cffe97c7
last_changed 0.000000
created 0.000000
0: 10.167.225.35:6789/0 mon.node1

你可能感兴趣的:(ceph中获取osdmap和monmap的方式)