-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
sh.status.txt
394 lines (268 loc) · 12.1 KB
/
sh.status.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
===========
sh.status()
===========
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. start-include-here
.. method:: sh.status()
When run on a :binary:`~bin.mongos` instance, prints a formatted report
of the sharding configuration and the information regarding existing
chunks in a :term:`sharded cluster`. The default behavior suppresses
the detailed chunk information if the total number of chunks is
greater than or equal to 20.
The :method:`sh.status()` method has the following parameter:
.. list-table::
:header-rows: 1
:widths: 20 20 80
* - Parameter
- Type
- Description
* - ``verbose``
- boolean
- Optional. Determines the level of verbosity.
If ``true``, the method displays:
- Full details of the chunk distribution across shards even if
you have 20 or more chunks, as well as the number of chunks
on each shard.
- Details of :ref:`active mongos instances
<sharding-status-mongoses>`.
If ``false``, the method displays:
- Full details of the chunk distribution across shards only if
you have less than 20 chunks. If you have 20 or more chunks,
the method instead returns a ``too many chunks to print ...``
message, showing only the number of chunks on each shard.
- Only the :ref:`version and number of active mongos
instances <sharding-status-mongoses>`.
The default verbose value is ``false``.
.. seealso:: :method:`db.printShardingStatus()`
.. end-include-here
Output Examples
---------------
The :ref:`sharding-status-version-fields` section displays information on the
:term:`config database`:
.. code-block:: javascript
--- Sharding Status ---
sharding version: {
"_id" : <num>,
"minCompatibleVersion" : <num>,
"currentVersion" : <num>,
"clusterId" : <ObjectId>
}
The :ref:`sharding-status-shards-fields` section lists information on
the shard(s). For each shard, the section displays the name, host, and
the associated tags, if any.
.. code-block:: javascript
shards:
{ "_id" : <shard name1>, "host" : <string>, "tags" : [ <string> ... ] }
{ "_id" : <shard name2>, "host" : <string>, "tags" : [ <string> ... ] }
...
The :ref:`sharding-status-mongoses` section displays, by default,
information on the version and count of :binary:`~bin.mongos` instances
that have been active within the last 60 seconds:
.. code-block:: javascript
active mongoses:
<version> : <num>
If the method is run with the ``verbose`` parameter to true, the
:ref:`sharding-status-mongoses` section displays additional information:
.. code-block:: javascript
active mongoses:
{ "_id" : "<hostname:port>", "ping" : <ISODate>, "up" : <long>, "waiting" : <boolean>, "mongoVersion" : <string> }
.. versionadded:: 3.0.0
The :ref:`sharding-status-balancer-fields` section lists information
about the state of the :term:`balancer`. This provides insight into
current balancer operation and can be useful when troubleshooting an
unbalanced sharded cluster.
.. code-block:: none
balancer:
Currently enabled: yes
Currently running: yes
Balancer lock taken at Wed Dec 10 2014 12:00:16 GMT+1100 (AEDT) by
Pixl.local:27017:1418172757:16807:Balancer:282475249
Collections with active migrations:
test.t2 started at Wed Dec 10 2014 11:54:51 GMT+1100 (AEDT)
Failed balancer rounds in last 5 attempts: 1
Last reported error: tag ranges not valid for: test.t2
Time of Reported error: Wed Dec 10 2014 12:00:33 GMT+1100 (AEDT)
Migration Results for the last 24 hours:
96 : Success
15 : Failed with error 'ns not found, should be impossible', from
shard01 to shard02
The :ref:`sharding-status-databases-fields` section lists information
on the database(s). For each database, the section displays the name,
whether the database has sharding enabled, and the :term:`primary
shard` for the database.
.. code-block:: javascript
databases:
{ "_id" : <dbname1>,
"partitioned" : <boolean>,
"primary" : <string>
}
{ "_id" : <dbname2>,
"partitioned" : <boolean>,
"primary" : <string>
}
...
The :ref:`sharding-status-collection-fields` section provides
information on the sharding details for sharded collection(s). For each
sharded collection, the section displays the shard key, the number of
chunks per shard(s), the distribution of chunks across shards
[#chunk-details]_, and the tag information, if any, for shard key
range(s).
.. code-block:: javascript
<dbname>.<collection>
shard key: { <shard key> : <1 or hashed> }
unique: <boolean>
balancing: <boolean>
chunks:
<shard name1> <number of chunks>
<shard name2> <number of chunks>
...
{ <shard key>: <min range1> } -->> { <shard key> : <max range1> } on : <shard name> <last modified timestamp>
{ <shard key>: <min range2> } -->> { <shard key> : <max range2> } on : <shard name> <last modified timestamp>
...
tag: <tag1> { <shard key> : <min range1> } -->> { <shard key> : <max range1> }
...
Output Fields
-------------
.. _sharding-status-version-fields:
Sharding Version
~~~~~~~~~~~~~~~~
.. data:: sh.status.sharding-version._id
The :data:`~sh.status.sharding-version._id` is an identifier
for the version details.
.. data:: sh.status.sharding-version.minCompatibleVersion
The :data:`~sh.status.sharding-version.minCompatibleVersion` is
the minimum compatible version of the config server.
.. data:: sh.status.sharding-version.currentVersion
The :data:`~sh.status.sharding-version.currentVersion` is
the current version of the config server.
.. data:: sh.status.sharding-version.clusterId
The :data:`~sh.status.sharding-version.clusterId` is the
identification for the sharded cluster.
.. _sharding-status-mongoses:
Active ``mongos`` Instances
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 3.2
.. data:: sh.status.active-mongoses
If ``verbose`` is ``false``, :data:`sh.status.active-mongoses` lists
the version and count of the active :binary:`~bin.mongos` instances.
Active :binary:`~bin.mongos` instances are :binary:`~bin.mongos`
instances that have been ping'ed within the last 60 seconds.
If ``verbose`` is ``true``, returns for each active :binary:`~bin.mongos` instance:
- Its hostname and port.
- Its most recent ping date and time.
- Its uptime since the last ping.
- Its waiting status.
- Its MongoDB version.
.. code-block:: javascript
active mongoses:
{ "_id" : "<hostname:port>", "ping" : <ISODate>, "up" : <long>, "waiting" : <boolean>, "mongoVersion" : <string> }
...
.. _sharding-status-shards-fields:
Shards
~~~~~~
.. data:: sh.status.shards._id
The :data:`~sh.status.shards._id` displays the name of the shard.
.. data:: sh.status.shards.host
The :data:`~sh.status.shards.host` displays the host location
of the shard.
.. data:: sh.status.shards.tags
The :data:`~sh.status.shards.tags` displays all the tags for
the shard. The field only displays if the shard has tags.
.. _sharding-status-balancer-fields:
Balancer
~~~~~~~~
.. versionadded:: 3.0.0
:method:`sh.status()` added the ``balancer`` field.
.. data:: sh.status.balancer.currently-enabled
:data:`~sh.status.balancer.currently-enabled` indicates if the
:term:`balancer` is currently enabled on the sharded cluster.
.. data:: sh.status.balancer.currently-running
:data:`~sh.status.balancer.currently-running` indicates whether
the :term:`balancer` is currently running, and therefore currently
balancing the cluster.
If the :term:`balancer` is running,
:data:`~sh.status.balancer.currently-running` lists the
process that holds the balancer lock, and the date and time that
the process obtained the lock.
If there is an active balancer lock,
:data:`~sh.status.balancer.currently-running` also reports the
state of the balancer.
.. data:: sh.status.balancer.collections-with-active-migrations
:data:`~sh.status.balancer.collections-with-active-migrations`
lists the names of any collections with active migrations, and
specifies when the migration began. If there are no active
migrations, this field will not appear in the :method:`sh.status()`
output.
.. data:: sh.status.balancer.failed-balancer-rounds-in-last-5-attempts
:data:`~sh.status.balancer.failed-balancer-rounds-in-last-5-attempts`
displays the number of :term:`balancer` rounds that failed, from among
the last five attempted rounds. A balancer round will fail when a chunk
migration fails.
.. data:: sh.status.balancer.last-reported-error
:data:`~sh.status.balancer.last-reported-error` lists the most
recent balancer error message. If there have been no errors, this
field will not appear in the :method:`sh.status()` output.
.. data:: sh.status.balancer.time-of-reported-error
:data:`~sh.status.balancer.time-of-reported-error` provides
the date and time of the most recently-reported error.
.. data:: sh.status.balancer.migration-results-for-the-last-24-hours
:data:`~sh.status.balancer.migration-results-for-the-last-24-hours`
displays the number of migrations in the last 24 hours, and the
error messages from failed
migrations . If there have been no recent migrations,
:data:`~sh.status.balancer.migration-results-for-the-last-24-hours`
displays ``No recent migrations``.
:data:`~sh.status.balancer.migration-results-for-the-last-24-hours`
includes *all* migrations, including those not initiated by the balancer.
.. _sharding-status-databases-fields:
Databases
~~~~~~~~~
.. data:: sh.status.databases._id
The :data:`~sh.status.databases._id` displays the name of the database.
.. data:: sh.status.databases.partitioned
The :data:`~sh.status.databases.partitioned` displays whether
the database has sharding enabled. If ``true``, the database has
sharding enabled.
.. data:: sh.status.databases.primary
The :data:`~sh.status.databases.primary` displays the
:term:`primary shard` for the database.
.. _sharding-status-collection-fields:
Sharded Collection
~~~~~~~~~~~~~~~~~~
.. data:: sh.status.databases.shard-key
The :data:`~sh.status.databases.shard-key` displays the shard
key specification document.
.. data:: sh.status.databases.<collection>.unique
The :data:`~sh.status.databases.<collection>.unique` displays
whether MongoDB enforces uniqueness on the shard key values (i.e.
whether the underlying shard key index is unique).
.. versionadded:: 3.2
.. data:: sh.status.databases.<collection>.balancing
The :data:`~sh.status.databases.<collection>.balancing` displays
whether balancing is enabled (``true``) or disabled (``false``) for
the collection.
.. versionadded:: 3.2
.. data:: sh.status.databases.<collection>.chunks
The :data:`~sh.status.databases.<collection>.chunks` lists all the shards
and the number of chunks that reside on each shard.
.. data:: sh.status.databases.<collection>.chunk-details
The :data:`~sh.status.databases.chunk-details` lists the details
of the chunks [#chunk-details]_:
- The range of shard key values that define the chunk,
- The shard where the chunk resides, and
- The last modified timestamp for the chunk.
.. data:: sh.status.databases.tag
The :data:`~sh.status.databases.tag` lists the details of
the tags associated with a range of shard key values.
.. [#chunk-details] The sharded collection section, by default,
displays the chunk information if the total number of chunks is less
than 20. To display the information when you have 20 or more chunks,
call the :method:`sh.status()` methods with the ``verbose`` parameter
set to ``true``, i.e. ``sh.status(true)``.