Skip to content

Commit 829a597

Browse files
[ONPREM-2564] - Add docs on how to go from 4.4 to 7.0 (#9776)
* Add docs on how to go from 4.4 to 7.0 * style and formatting * Add curly brackets around manual response --------- Co-authored-by: rosie yohannan <[email protected]>
1 parent 51cfed7 commit 829a597

File tree

1 file changed

+175
-34
lines changed

1 file changed

+175
-34
lines changed
Lines changed: 175 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,236 @@
11
= Upgrade MongoDB
22
:page-platform: Server 4.9, Server Admin
3-
:page-description: Learn how to upgrade MongoDB up to v4.4.15 in an installation of CircleCI server 4.9.
3+
:page-description: Learn how to upgrade MongoDB up to v7.0.15 in an installation of CircleCI server 4.9.
44
:experimental:
55

6-
MongoDB is a database service used by CircleCI server. This page describes how to upgrade MongoDB to version `4.4.15`.
6+
MongoDB is a database service used by CircleCI server. This page describes how to upgrade MongoDB from version `3.6.22` to `7.0.15`.
77

88
MongoDB `3.6.22` is shipped with CircleCI server 4.9.
99

10-
[#prerequisites]
11-
== Prerequisites
10+
[#upgrade-mongodb-to-4.4]
11+
== Upgrade MongoDB to 4.4
1212

13-
* Ensure backups have been taken. You will need a backup of MongoDB to restore to in case anything goes wrong during the upgrade progress
14-
* You are prepared to modify the `values.yaml`
15-
* `helm upgrade` will work from your system to upgrade the cluster
16-
* MongoDB root password is available
13+
[#prerequisites-4.4]
14+
=== Prerequisites
1715

18-
[#script-upgrade]
19-
== Scripted upgrade
20-
We have created a shell script which may be used to upgrade your cluster's MongoDB instance link:https://github.com/CircleCI-Public/server-scripts/tree/main/upgrade-mongo-to-4.4[here].
21-
If you wish, you may use the following instructions to manually upgrade your cluster's MongoDB
16+
* Ensure backups have been taken. You need a backup of MongoDB to restore in case anything goes wrong during the upgrade progress.
17+
* You are able to modify your `values.yaml` file.
18+
* `helm upgrade` works from your system to upgrade the cluster.
19+
* Your MongoDB root password is available
2220
23-
[#manual-upgrade]
24-
== Manual upgrade
21+
[#script-upgrade-4.4]
22+
=== Scripted upgrade
23+
We have created a shell script that you can use to upgrade your cluster's MongoDB instance link:https://github.com/CircleCI-Public/server-scripts/tree/main/upgrade-mongo-to-4.4[here].
2524

26-
=== 1. Upgrade from MongoDB 3.6 to 4.0
25+
Alternatively, you can use the following instructions to manually upgrade your cluster's MongoDB:
26+
27+
[#manual-upgrade-4.4]
28+
=== Manual upgrade
29+
30+
==== 1. Upgrade from MongoDB 3.6 to 4.0
2731

2832
. Your `values.yaml` should contain the following snippet:
2933
+
30-
```yaml
34+
[source,yaml]
35+
----
3136
mongodb:
3237
image:
3338
tag: 3.6.22-debian-9-r38
34-
```
39+
----
3540
+
3641
To begin the upgrade process, change the tag to `4.0.27-debian-9-r118`:
3742
+
38-
```yaml
43+
[source,yaml]
44+
----
3945
mongodb:
4046
image:
4147
tag: 4.0.27-debian-9-r118
42-
```
48+
----
4349

4450
. Run `helm upgrade` to update your installation.
4551

4652
. Once the `helm upgrade` has completed and MongoDB has rolled, you will need to `exec` into the pod (with the root password handy) to modify the compatibility version. (Be sure to replace `<password>` with your MongoDB root password.)
4753
+
48-
```bash
49-
kubectl exec -it mongodb-0 -- mongo -u root -p <password>
54+
[source,console]
55+
----
56+
$ kubectl exec -it mongodb-0 -- mongo -u root -p <password>
5057
db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } )
51-
```
58+
----
5259

5360
. You should get a `{ "ok" : 1 }` response from Mongo. Exit out of the MongoDB shell and pod.
5461

55-
=== 2. Upgrade from MongoDB 4.0 to 4.2
62+
==== 2. Upgrade from MongoDB 4.0 to 4.2
5663

5764
. Change the tag to `4.2.21-debian-10-r8`:
5865
+
59-
```yaml
66+
[source,yaml]
67+
----
6068
mongodb:
6169
image:
6270
tag: 4.2.21-debian-10-r8
63-
```
71+
----
6472

6573
. Run `helm upgrade` to update your installation.
6674

6775
. Once the `helm upgrade` has completed and MongoDB has rolled, you will need to `exec` into the pod (with the root password handy) to modify the compatibility version. (Be sure to replace `<password>` with your MongoDB root password.)
6876
+
69-
```bash
70-
kubectl exec -it mongodb-0 -- mongo -u root -p <password>
77+
[source,console]
78+
----
79+
$ kubectl exec -it mongodb-0 -- mongo -u root -p <password>
7180
db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )
72-
```
81+
----
7382

7483
. You should get `{ "ok" : 1 }` again. Exit out of the shell and pod.
7584

76-
=== 3. Upgrade from MongoDB 4.2 to 4.4
85+
==== 3. Upgrade from MongoDB 4.2 to 4.4
7786

7887
. Change the tag one more time to `4.4.15-debian-10-r8`:
7988
+
80-
```yaml
89+
[source,yaml]
90+
----
8191
mongodb:
8292
image:
8393
tag: 4.4.15-debian-10-r8
84-
```
94+
----
8595

8696
. Run `helm upgrade` to update your installation.
8797

8898
. Once the `helm upgrade` has completed and MongoDB has rolled, you will need to `exec` into the pod (with the root password handy) to modify the compatibility version. (Be sure to replace `<password>` with your MongoDB root password.)
8999
+
90-
```bash
91-
kubectl exec -it mongodb-0 -- mongo -u root -p <password>
100+
[source,console]
101+
----
102+
$ kubectl exec -it mongodb-0 -- mongo -u root -p <password>
92103
db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
93-
```
104+
----
94105

95106
. Once you receive `{ "ok" : 1 }`, you have successfully upgraded your MongoDB to 4.4.15.
107+
108+
[#upgrade-mongodb-to-7.0]
109+
== Upgrade MongoDB to 7.0
110+
111+
[#prerequisites-7.0]
112+
=== Prerequisites
113+
114+
* You have completed the `4.4.15` upgrade above.
115+
* Ensure backups have been taken. You need a backup of MongoDB to restore in case anything goes wrong during the upgrade progress.
116+
* You are able to modify your `values.yaml` file.
117+
* `helm upgrade` works from your system to upgrade the cluster.
118+
* Your MongoDB root password is available.
119+
120+
[#script-upgrade-7.0]
121+
=== Scripted upgrade
122+
We have created a shell script that you can use to upgrade your cluster's MongoDB instance link:https://github.com/CircleCI-Public/server-scripts/tree/main/upgrade-mongo-to-7.0[here].
123+
124+
Alternatively, you can use the following instructions to manually upgrade your cluster's MongoDB:
125+
126+
[#manual-upgrade-7.0]
127+
=== Manual upgrade
128+
129+
==== 1. Upgrade from MongoDB 4.4 to 5.0
130+
131+
. Your `values.yaml` should contain the following snippet:
132+
+
133+
[source,yaml]
134+
----
135+
mongodb:
136+
image:
137+
tag: 4.4.15-debian-10-r8
138+
----
139+
+
140+
To begin the upgrade process, change the tag to `5.0.24-debian-11-r20` and update the probes to use `mongosh`:
141+
+
142+
[source,yaml]
143+
----
144+
mongodb:
145+
image:
146+
tag: 5.0.24-debian-11-r20
147+
livenessProbe:
148+
enabled: false
149+
readinessProbe:
150+
enabled: false
151+
customLivenessProbe:
152+
exec:
153+
command:
154+
- mongosh
155+
- --eval
156+
- "db.adminCommand('ping')"
157+
initialDelaySeconds: 30
158+
periodSeconds: 10
159+
timeoutSeconds: 5
160+
successThreshold: 1
161+
failureThreshold: 6
162+
customReadinessProbe:
163+
exec:
164+
command:
165+
- bash
166+
- -ec
167+
- |
168+
mongosh --eval 'db.hello().isWritablePrimary || db.hello().secondary' | grep -q 'true'
169+
initialDelaySeconds: 5
170+
periodSeconds: 10
171+
timeoutSeconds: 5
172+
successThreshold: 1
173+
failureThreshold: 6
174+
----
175+
176+
. Run `helm upgrade` to update your installation.
177+
178+
. Once the `helm upgrade` has completed and MongoDB has rolled, you will need to `exec` into the pod (with the root password handy) to modify the compatibility version. Note that MongoDB 5.0+ uses `mongosh` instead of `mongo`. (Be sure to replace `<password>` with your MongoDB root password.)
179+
+
180+
[source,console]
181+
----
182+
$ kubectl exec -it mongodb-0 -- mongosh -u root -p <password>
183+
db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } )
184+
----
185+
186+
. You should get an `{ "ok" : 1 }` response from MongoDB. Exit out of the MongoDB shell and pod.
187+
188+
==== 2. Upgrade from MongoDB 5.0 to 6.0
189+
190+
. Change the tag to `6.0.13-debian-11-r21` while being sure to keep the new `customLivenessProbe` and `customReadinessProbe` parameters.:
191+
+
192+
[source,yaml]
193+
----
194+
mongodb:
195+
image:
196+
tag: 6.0.13-debian-11-r21
197+
----
198+
199+
. Run `helm upgrade` to update your installation.
200+
201+
. Once the `helm upgrade` has completed and MongoDB has rolled, you will need to `exec` into the pod (with the root password handy) to modify the compatibility version. (Be sure to replace `<password>` with your MongoDB root password.)
202+
+
203+
[source,console]
204+
----
205+
$ kubectl exec -it mongodb-0 -- mongosh -u root -p <password>
206+
db.adminCommand( { setFeatureCompatibilityVersion: "6.0" } )
207+
----
208+
209+
. You should get `{ "ok" : 1 }`` again. Exit out of the shell and pod.
210+
211+
==== 3. Upgrade from MongoDB 6.0 to 7.0
212+
213+
. Change the tag to `7.0.15-debian-12-r2`:
214+
+
215+
[source,yaml]
216+
----
217+
mongodb:
218+
image:
219+
tag: 7.0.15-debian-12-r2
220+
----
221+
222+
. Run `helm upgrade` to update your installation.
223+
224+
. Once the `helm upgrade` has completed and MongoDB has rolled, you will need to `exec` into the pod (with the root password handy) to modify the compatibility version (be sure to replace `<password>` with your MongoDB root password.)
225+
+
226+
CAUTION: MongoDB 7.0+ upgrade is one-way and cannot be downgraded.
227+
+
228+
NOTE: MongoDB 7.0+ requires the `confirm: true` parameter.
229+
+
230+
[source,console]
231+
----
232+
$ kubectl exec -it mongodb-0 -- mongosh -u root -p <password>
233+
db.adminCommand( { setFeatureCompatibilityVersion: "7.0", confirm: true } )
234+
----
235+
236+
. Once you receive `{ "ok" : 1 }``, you have successfully upgraded your MongoDB to 7.0.15.

0 commit comments

Comments
 (0)