]> git.proxmox.com Git - ceph.git/blame - ceph/doc/cephfs/multimds.rst
update sources to v12.1.2
[ceph.git] / ceph / doc / cephfs / multimds.rst
CommitLineData
7c673cae
FG
1
2Configuring multiple active MDS daemons
3---------------------------------------
4
5*Also known as: multi-mds, active-active MDS*
6
7Each CephFS filesystem is configured for a single active MDS daemon
8by default. To scale metadata performance for large scale systems, you
9may enable multiple active MDS daemons, which will share the metadata
10workload with one another.
11
12When should I use multiple active MDS daemons?
13~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14
15You should configure multiple active MDS daemons when your metadata performance
16is bottlenecked on the single MDS that runs by default.
17
18Adding more daemons may not increase performance on all workloads. Typically,
19a single application running on a single client will not benefit from an
20increased number of MDS daemons unless the application is doing a lot of
21metadata operations in parallel.
22
23Workloads that typically benefit from a larger number of active MDS daemons
24are those with many clients, perhaps working on many separate directories.
25
26
27Increasing the MDS active cluster size
28~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29
30Each CephFS filesystem has a *max_mds* setting, which controls
31how many ranks will be created. The actual number of ranks
32in the filesystem will only be increased if a spare daemon is
33available to take on the new rank. For example, if there is only one MDS daemon running, and max_mds is set to two, no second rank will be created.
34
35Set ``max_mds`` to the desired number of ranks. In the following examples
36the "fsmap" line of "ceph status" is shown to illustrate the expected
37result of commands.
38
39::
40
41 # fsmap e5: 1/1/1 up {0=a=up:active}, 2 up:standby
42
43 ceph fs set max_mds 2
44
45 # fsmap e8: 2/2/2 up {0=a=up:active,1=c=up:creating}, 1 up:standby
46 # fsmap e9: 2/2/2 up {0=a=up:active,1=c=up:active}, 1 up:standby
47
48The newly created rank (1) will pass through the 'creating' state
49and then enter this 'active state'.
50
51Standby daemons
52~~~~~~~~~~~~~~~
53
54Even with multiple active MDS daemons, a highly available system **still
55requires standby daemons** to take over if any of the servers running
56an active daemon fail.
57
58Consequently, the practical maximum of ``max_mds`` for highly available systems
59is one less than the total number of MDS servers in your system.
60
61To remain available in the event of multiple server failures, increase the
62number of standby daemons in the system to match the number of server failures
63you wish to withstand.
64
65Decreasing the number of ranks
66~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
68All ranks, including the rank(s) to be removed must first be active. This
69means that you must have at least max_mds MDS daemons available.
70
71First, set max_mds to a lower number, for example we might go back to
72having just a single active MDS:
73
74::
75
76 # fsmap e9: 2/2/2 up {0=a=up:active,1=c=up:active}, 1 up:standby
77 ceph fs set max_mds 1
78 # fsmap e10: 2/2/1 up {0=a=up:active,1=c=up:active}, 1 up:standby
79
80Note that we still have two active MDSs: the ranks still exist even though
81we have decreased max_mds, because max_mds only restricts creation
82of new ranks.
83
c07f9fc5 84Next, use the ``ceph mds deactivate <role>`` command to remove the
7c673cae
FG
85unneeded rank:
86
87::
88
89 ceph mds deactivate cephfs_a:1
90 telling mds.1:1 172.21.9.34:6806/837679928 to deactivate
91
92 # fsmap e11: 2/2/1 up {0=a=up:active,1=c=up:stopping}, 1 up:standby
93 # fsmap e12: 1/1/1 up {0=a=up:active}, 1 up:standby
94 # fsmap e13: 1/1/1 up {0=a=up:active}, 2 up:standby
95
c07f9fc5
FG
96See :doc:`/cephfs/administration` for more details which forms ``<role>`` can
97take.
98
7c673cae
FG
99The deactivated rank will first enter the stopping state for a period
100of time while it hands off its share of the metadata to the remaining
101active daemons. This phase can take from seconds to minutes. If the
102MDS appears to be stuck in the stopping state then that should be investigated
103as a possible bug.
104
105If an MDS daemon crashes or is killed while in the 'stopping' state, a
106standby will take over and the rank will go back to 'active'. You can
107try to deactivate it again once it has come back up.
108
109When a daemon finishes stopping, it will respawn itself and go
110back to being a standby.
111
112
113Manually pinning directory trees to a particular rank
114~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
115
116In multiple active metadata server configurations, a balancer runs which works
117to spread metadata load evenly across the cluster. This usually works well
118enough for most users but sometimes it is desirable to override the dynamic
119balancer with explicit mappings of metadata to particular ranks. This can allow
120the administrator or users to evenly spread application load or limit impact of
121users' metadata requests on the entire cluster.
122
123The mechanism provided for this purpose is called an ``export pin``, an
124extended attribute of directories. The name of this extended attribute is
125``ceph.dir.pin``. Users can set this attribute using standard commands:
126
127::
31f18b77 128
7c673cae
FG
129 setfattr -n ceph.dir.pin -v 2 path/to/dir
130
131The value of the extended attribute is the rank to assign the directory subtree
132to. A default value of ``-1`` indicates the directory is not pinned.
133
134A directory's export pin is inherited from its closest parent with a set export
135pin. In this way, setting the export pin on a directory affects all of its
136children. However, the parents pin can be overriden by setting the child
137directory's export pin. For example:
138
139::
31f18b77 140
7c673cae
FG
141 mkdir -p a/b
142 # "a" and "a/b" both start without an export pin set
143 setfattr -n ceph.dir.pin -v 1 a/
144 # a and b are now pinned to rank 1
145 setfattr -n ceph.dir.pin -v 0 a/b
146 # a/b is now pinned to rank 0 and a/ and the rest of its children are still pinned to rank 1
31f18b77 147