@@ -10,60 +10,88 @@ flushRouterConfig
10
10
:depth: 1
11
11
:class: singlecol
12
12
13
+ Definition
14
+ ----------
15
+
13
16
.. dbcommand:: flushRouterConfig
14
17
15
- :dbcommand:`flushRouterConfig` clears the cached routing table. Use
16
- this command to force a refresh of the routing table cache. In most
17
- cases, this happens automatically. You should only need to run
18
- :dbcommand:`flushRouterConfig` after :dbcommand:`movePrimary` has
19
- been run or after manually clearing the ``jumbo`` chunk flag.
18
+ :dbcommand:`flushRouterConfig` marks the cached routing table for a
19
+ sharded cluster as stale, causing the next operation that requests
20
+ the routing table to refresh the cache. Management of the routing
21
+ table cache is generally handled automatically by the cluster. You
22
+ should only need to run the :dbcommand:`flushRouterConfig` command
23
+ manually in specific instances, as indicated under
24
+ :ref:`flushrouterconfig-considerations`.
25
+
26
+ .. note::
27
+
28
+ **Starting in MongoDB 4.4,** running :dbcommand:`flushRouterConfig`
29
+ is no longer required after executing the :dbcommand:`movePrimary` or
30
+ :dbcommand:`dropDatabase` commands. These two commands now
31
+ automatically refresh a sharded cluster's routing table as needed
32
+ when run.
33
+
34
+ Syntax
35
+ ------
36
+
37
+ Starting in MongoDB 4.0.6 (and 3.6.11), the
38
+ :dbcommand:`flushRouterConfig` is available on both
39
+ :binary:`~bin.mongos` and :binary:`~bin.mongod` instances, and has the
40
+ following syntax:
41
+
42
+ - Flush the cache for a specified collection when passed in a
43
+ collection namespace parameter:
20
44
21
- - **Starting in MongoDB 4.0.6 (and 3.6.11),**
22
- :dbcommand:`flushRouterConfig` is available on both
23
- :binary:`~bin.mongos` instances and :binary:`~bin.mongod`
24
- instances and can:
45
+ .. code-block:: javascript
25
46
26
- - Flush the cache for a specified collection when passed in a
27
- collection namespace parameter:
47
+ db.adminCommand({ flushRouterConfig: "<db.collection>" } )
28
48
29
- .. code-block:: javascript
49
+ - Flush the cache for a specified database and all of its collections
50
+ when passed in a database namespace parameter:
30
51
31
- db.adminCommand({ flushRouterConfig: "<db.collection>" } )
52
+ .. code-block:: javascript
32
53
33
- - Flush the cache for a specified database and its collections
34
- when passed in a database namespace parameter:
54
+ db.adminCommand({ flushRouterConfig: "<db>" } )
35
55
36
- .. code-block:: javascript
56
+ - Flush the cache for all databases and their collections when run
57
+ without a parameter or passed in a non-string scalar value
58
+ (e.g. ``1``):
37
59
38
- db.adminCommand({ flushRouterConfig: "<db>" } )
60
+ .. code-block:: javascript
39
61
40
- - Flush the cache for all databases and their collections when run
41
- without a parameter or passed in a non-string scalar value (e.g. ``1``):
62
+ db.adminCommand("flushRouterConfig")
63
+ db.adminCommand( { flushRouterConfig: 1 } )
42
64
43
- .. code-block:: javascript
65
+ .. note::
44
66
45
- db.adminCommand("flushRouterConfig")
46
- db.adminCommand( { flushRouterConfig: 1 } )
67
+ **In MongoDB 4.0.5 and earlier (and 3.6.10 and earlier)**,
68
+ :dbcommand:`flushRouterConfig` is only available for
69
+ :binary:`~bin.mongos` instances and can only flush the cache for all
70
+ databases and their collections:
47
71
48
- - **In MongoDB 4.0.5 and earlier (and 3.6.10 and earlier)**,
49
- :dbcommand:`flushRouterConfig` is only available for
50
- :binary:`~bin.mongos` instances and can flush the cache for all
51
- databases and their collections:
72
+ .. code-block:: javascript
52
73
53
- .. code-block:: javascript
74
+ db.adminCommand("flushRouterConfig")
75
+ db.adminCommand( { flushRouterConfig: 1 } )
54
76
55
- db.adminCommand("flushRouterConfig")
56
- db.adminCommand( { flushRouterConfig: 1 } )
77
+ .. _flushrouterconfig-considerations:
57
78
58
79
Considerations
59
80
--------------
60
81
61
- You should only need to run :dbcommand:`flushRouterConfig` after
62
- :dbcommand:`movePrimary` has been run or after manually clearing the
63
- ``jumbo`` chunk flag.
82
+ Generally, a sharded cluster's routing table is automatically refreshed
83
+ as needed as part of normal operation. However, you should manually
84
+ issue the :dbcommand:`flushRouterConfig` command in the following
85
+ instances:
64
86
65
- .. seealso::
87
+ - If running MongoDB 4.2 or earlier, after executing the
88
+ :dbcommand:`movePrimary` or :dbcommand:`dropDatabase` commands.
66
89
67
- - :ref:`movePrimary Considerations <movePrimary-consideration>`
90
+ - If running MongoDB 4.2.2 or earlier (or 4.0.14 or earlier), after
91
+ manually clearing the ``jumbo`` flag from a chunk that could not be
92
+ split (i.e. an *indivisible chunk*). See
93
+ :doc:`/tutorial/clear-jumbo-flag` for more information.
68
94
69
- - :doc:`/tutorial/clear-jumbo-flag`
95
+ - Before running the :method:`db.collection.getShardDistribution()`
96
+ command. This ensures that the command returns the most up-to-date
97
+ information.
0 commit comments