@@ -83,12 +83,102 @@ control the :binary:`~bin.mongod` instance, you can set the ``KRB5_KTNAME``
83
83
variable in the default environment settings file instead of setting
84
84
the variable each time.
85
85
86
- For ``.rpm`` packages, the default environment settings file is
86
+ Recent versions of Red Hat and Debian-based systems use ``systemd``.
87
+ Older versions use ``init`` for system initialization. Follow the
88
+ appropriate instructions to configure the ``KRB5_KTNAME`` variable for
89
+ your system.
90
+
91
+ ``systemd`` Configuration Files
92
+ ```````````````````````````````
93
+
94
+ ``systemd`` stores configuration in unit files. Update the unit file to
95
+ set the ``KRB5_KTNAME`` variable.
96
+
97
+ .. procedure::
98
+ :style: normal
99
+
100
+ .. step:: Find the unit file
101
+
102
+ .. code-block:: shell
103
+
104
+ sudo systemctl cat mongod
105
+
106
+ The ``systemctl`` command returns the file location and displays its
107
+ contents.
108
+
109
+ .. step:: Set ``KRB5_KTNAME``
110
+
111
+ To set the ``KRB5_KTNAME`` variable, edit the following line to reflect
112
+ the location of your ``keytab`` file:
113
+
114
+ .. code-block:: shell
115
+
116
+ Environment="KRB5_KTNAME=<path-to-your-mongod.keytab-file>"
117
+
118
+ .. step:: Edit the unit file
119
+
120
+ Add the edited line to the unit file. The edited unit file will
121
+ resemble:
122
+
123
+ .. code-block:: shell
124
+ :copyable: false
125
+ :emphasize-lines: 9
126
+
127
+ [Unit]
128
+ Description=High-performance, schema-free document-oriented database
129
+ After=network.target
130
+ Documentation=https://docs.mongodb.org/manual
131
+
132
+ [Service]
133
+ User=mongodb
134
+ Group=mongodb
135
+ ExecStart=/usr/bin/mongod --config /etc/mongod.conf
136
+ Environment="KRB5_KTNAME=/etc/mongod.keytab"
137
+ PIDFile=/var/run/mongodb/mongod.pid
138
+ # file size
139
+ LimitFSIZE=infinity
140
+ # cpu time
141
+ LimitCPU=infinity
142
+ # virtual memory size
143
+ LimitAS=infinity
144
+ # open files
145
+ LimitNOFILE=64000
146
+ # processes/threads
147
+ LimitNPROC=64000
148
+ # locked memory
149
+ LimitMEMLOCK=infinity
150
+ # total threads (user+kernel)
151
+ TasksMax=infinity
152
+ TasksAccounting=false
153
+
154
+ # Recommended limits for for mongod as specified in
155
+ # http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
156
+
157
+ [Install]
158
+ WantedBy=multi-user.target
159
+
160
+ .. step:: Reload the updated unit file:
161
+
162
+ .. code-block:: shell
163
+
164
+ sudo systemctl daemon-reload
165
+
166
+ .. step:: Restart the :binary:`mongod` service
167
+
168
+ .. code-block:: shell
169
+
170
+ sudo systemctl restart mongod
171
+
172
+ ``init`` Configuration Files
173
+ ````````````````````````````
174
+
175
+ For ``.rpm`` installations, the default environment settings file is
87
176
:file:`/etc/sysconfig/mongod`.
88
177
89
- For ``.deb`` packages , the file is :file:`/etc/default/mongodb`.
178
+ For ``.deb`` installations , the file is :file:`/etc/default/mongodb`.
90
179
91
- Set the ``KRB5_KTNAME`` value in a line that resembles the following:
180
+ Set the ``KRB5_KTNAME`` value by adding a line that resembles the
181
+ following:
92
182
93
183
.. code-block:: javascript
94
184
0 commit comments