Il rilascio di UniFi Network Server della versione 7.5.187 ha introdotto il supporto per MongoDB fino alla versione 4.4.
A partire dalla versione 8.1.113 di UniFi Network Server, MongoDB 7.0 è supportato.
Passare direttamente dalla versione 4.4 a 7.0 purtroppo non è possibile. È necessario un aggiornamento intermedio.
Gli aggiornamenti di MongoDB richiedono un approccio incrementale, il che significa che è necessario eseguire l’aggiornamento a ciascuna versione intermedia prima di raggiungere quella più recente.
In questo tutorial ti mostrerò come fare l’upgrade dalla versione di MongoDB 3.6 alla versione 7.0 passando dalle version1 4.0.28, 4.2.23, 4.4.29, 5.0.26 e 6.0.15
PREREQUISITI
Controller Unifi superiore alla 8.1.113 (In questo tutorial la versione del Controller Unifi è la 8.4.59)
CHECK VERSIONE DI MONGODB INSTALLATA SUL SERVER UNIFI
Verificare la versione di MongoDB installata con il comando:
0 |
mongod --version
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
8
|
db version v3.6.23
git version: d352e6a4764659e0d0350ce77279de3c1f243e5c
OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1804
distarch: x86_64
target_arch: x86_64
|
AGGIORNAMENTO DI MONGODB DALLA VERSIONE 3.6 ALLA VERSIONE 4.0.28
Fermare il servizio Unifi con il comando:
0 |
systemctl stop unifi
|
Scaricare MongoDB 4.0.28 con il comando:
0 |
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.28.tgz -P /tmp/
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
8
9
|
--2024-09-04 16:26:08-- https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.28.tgz
Resolving fastdl.mongodb.org (fastdl.mongodb.org)... 18.161.111.41, 18.161.111.6, 18.161.111.14, ...
Connecting to fastdl.mongodb.org (fastdl.mongodb.org)|18.161.111.41|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 86084214 (82M) [application/x-gzip]
Saving to: ‘/tmp/mongodb-linux-x86_64-4.0.28.tgz’
mongodb-linux-x86_64-4.0.28.tgz 100%[===========================================================>] 82.10M 65.3MB/s in 1.3s
2024-09-04 16:26:10 (65.3 MB/s) - ‘/tmp/mongodb-linux-x86_64-4.0.28.tgz’ saved [86084214/86084214]
|
Estrarre MongoDB 4.0.28 con il comando:
0 |
tar xvzf /tmp/mongodb-linux-x86_64-4.0.28.tgz -C /tmp/
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
mongodb-linux-x86_64-4.0.28/THIRD-PARTY-NOTICES.gotools
mongodb-linux-x86_64-4.0.28/README
mongodb-linux-x86_64-4.0.28/THIRD-PARTY-NOTICES
mongodb-linux-x86_64-4.0.28/MPL-2
mongodb-linux-x86_64-4.0.28/LICENSE-Community.txt
mongodb-linux-x86_64-4.0.28/bin/mongodump
mongodb-linux-x86_64-4.0.28/bin/mongorestore
mongodb-linux-x86_64-4.0.28/bin/mongoexport
mongodb-linux-x86_64-4.0.28/bin/mongoimport
mongodb-linux-x86_64-4.0.28/bin/mongostat
mongodb-linux-x86_64-4.0.28/bin/mongotop
mongodb-linux-x86_64-4.0.28/bin/bsondump
mongodb-linux-x86_64-4.0.28/bin/mongofiles
mongodb-linux-x86_64-4.0.28/bin/mongoreplay
mongodb-linux-x86_64-4.0.28/bin/mongod
mongodb-linux-x86_64-4.0.28/bin/mongos
mongodb-linux-x86_64-4.0.28/bin/mongo
mongodb-linux-x86_64-4.0.28/bin/install_compass
|
Avviare MongoDB 4.0.28 in background con il comando:
0 |
sudo -u unifi /tmp/mongodb-linux-x86_64-4.0.28/bin/./mongod --port 27117 --dbpath /var/lib/unifi/db & PROCMONGO40=$!
|
Esecuzione della compatibilità delle funzionalità versione 4.0 con il comando:
0 |
/tmp/mongodb-linux-x86_64-4.0.28/bin/./mongo --port 27117 --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } ) '
|
Spegnere MongoDB 4.0.28 con il comando:
0 |
pkill -P $PROCMONGO40
|
Dovremmo visualizzare il seguente output:
0
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
|
2024-09-04T16:32:29.247+0000 I CONTROL [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2024-09-04T16:32:29.247+0000 I CONTROL [signalProcessingThread] Shutdown started
2024-09-04T16:32:29.248+0000 I REPL [signalProcessingThread] Stepping down the ReplicationCoordinator for shutdown, waitTime: 10000ms
2024-09-04T16:32:29.248+0000 I CONTROL [signalProcessingThread] Shutting down the LogicalSessionCache
2024-09-04T16:32:29.248+0000 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets...
2024-09-04T16:32:29.248+0000 I NETWORK [signalProcessingThread] removing socket file: /tmp/mongodb-27117.sock
2024-09-04T16:32:29.248+0000 I NETWORK [signalProcessingThread] Shutting down the global connection pool
2024-09-04T16:32:29.248+0000 I STORAGE [signalProcessingThread] Shutting down the PeriodicThreadToAbortExpiredTransactions
2024-09-04T16:32:29.248+0000 I REPL [signalProcessingThread] Shutting down the ReplicationCoordinator
2024-09-04T16:32:29.248+0000 I SHARDING [signalProcessingThread] Shutting down the ShardingInitializationMongoD
2024-09-04T16:32:29.248+0000 I COMMAND [signalProcessingThread] Killing all open transactions
2024-09-04T16:32:29.248+0000 I - [signalProcessingThread] Killing all operations for shutdown
2024-09-04T16:32:29.248+0000 I NETWORK [signalProcessingThread] Shutting down the ReplicaSetMonitor
2024-09-04T16:32:29.248+0000 I CONTROL [signalProcessingThread] Shutting down free monitoring
2024-09-04T16:32:29.249+0000 I FTDC [signalProcessingThread] Shutting down full-time data capture
2024-09-04T16:32:29.249+0000 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture
2024-09-04T16:32:29.250+0000 I STORAGE [signalProcessingThread] Shutting down the HealthLog
2024-09-04T16:32:29.250+0000 I STORAGE [signalProcessingThread] Shutting down the storage engine
2024-09-04T16:32:29.251+0000 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down
2024-09-04T16:32:29.251+0000 I STORAGE [signalProcessingThread] Shutting down session sweeper thread
2024-09-04T16:32:29.251+0000 I STORAGE [signalProcessingThread] Finished shutting down session sweeper thread
root@VM-SRV-UBU-UNIFI:~# 2024-09-04T16:32:29.362+0000 I STORAGE [signalProcessingThread] shutdown: removing fs lock...
2024-09-04T16:32:29.363+0000 I - [signalProcessingThread] Dropping the scope cache for shutdown
2024-09-04T16:32:29.363+0000 I CONTROL [signalProcessingThread] now exiting
2024-09-04T16:32:29.363+0000 I CONTROL [signalProcessingThread] shutting down with code:0
[1]+ Done sudo -u unifi /tmp/mongodb-linux-x86_64-4.0.28/bin/./mongod --port 27117 --dbpath /var/lib/unifi/db
|
AGGIORNAMENTO DI MONGODB DALLA VERSIONE 4.0.28 ALLA VERSIONE 4.2.23
Scaricare MongoDB 4.2.23 con il comando:
0 |
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian10-4.2.23.tgz -P /tmp/
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
8
9
|
--2024-09-04 16:36:40-- https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian10-4.2.23.tgz
Resolving fastdl.mongodb.org (fastdl.mongodb.org)... 18.161.111.41, 18.161.111.6, 18.161.111.14, ...
Connecting to fastdl.mongodb.org (fastdl.mongodb.org)|18.161.111.41|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 133414039 (127M) [application/gzip]
Saving to: ‘/tmp/mongodb-linux-x86_64-debian10-4.2.23.tgz’
mongodb-linux-x86_64-debian10-4.2 100%[===========================================================>] 127.23M 79.8MB/s in 1.6s
2024-09-04 16:36:42 (79.8 MB/s) - ‘/tmp/mongodb-linux-x86_64-debian10-4.2.23.tgz’ saved [133414039/133414039]
|
Estrarre MongoDB 4.2.23 con il comando:
0 |
tar xvzf /tmp/mongodb-linux-x86_64-debian10-4.2.23.tgz -C /tmp/
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
mongodb-linux-x86_64-debian10-4.2.23/THIRD-PARTY-NOTICES.gotools
mongodb-linux-x86_64-debian10-4.2.23/README
mongodb-linux-x86_64-debian10-4.2.23/THIRD-PARTY-NOTICES
mongodb-linux-x86_64-debian10-4.2.23/MPL-2
mongodb-linux-x86_64-debian10-4.2.23/LICENSE-Community.txt
mongodb-linux-x86_64-debian10-4.2.23/bin/mongodump
mongodb-linux-x86_64-debian10-4.2.23/bin/mongorestore
mongodb-linux-x86_64-debian10-4.2.23/bin/mongoexport
mongodb-linux-x86_64-debian10-4.2.23/bin/mongoimport
mongodb-linux-x86_64-debian10-4.2.23/bin/mongostat
mongodb-linux-x86_64-debian10-4.2.23/bin/mongotop
mongodb-linux-x86_64-debian10-4.2.23/bin/bsondump
mongodb-linux-x86_64-debian10-4.2.23/bin/mongofiles
mongodb-linux-x86_64-debian10-4.2.23/bin/mongoreplay
mongodb-linux-x86_64-debian10-4.2.23/bin/mongod
mongodb-linux-x86_64-debian10-4.2.23/bin/mongos
mongodb-linux-x86_64-debian10-4.2.23/bin/mongo
mongodb-linux-x86_64-debian10-4.2.23/bin/install_compass
|
Avviare MongoDB 4.2.23 in background con il comando:
0 |
sudo -u unifi /tmp/mongodb-linux-x86_64-debian10-4.2.23/bin/./mongod --port 27117 --dbpath /var/lib/unifi/db & PROCMONGO42=$!
|
Esecuzione della compatibilità delle funzionalità versione 4.2 con il comando:
0 |
/tmp/mongodb-linux-x86_64-debian10-4.2.23/bin/./mongo --port 27117 --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } )'
|
Spegnere MongoDB 4.2.23 con il comando:
0 |
pkill -P $PROCMONGO42
|
Dovremmo visualizzare il seguente output:
0
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
|
2024-09-04T16:39:46.871+0000 I CONTROL [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2024-09-04T16:39:46.871+0000 I REPL [signalProcessingThread] Stepping down the ReplicationCoordinator for shutdown, waitTime: 10000ms
root@VM-SRV-UBU-UNIFI:~# 2024-09-04T16:39:46.874+0000 I SHARDING [signalProcessingThread] Shutting down the WaitForMajorityService
2024-09-04T16:39:46.875+0000 I CONTROL [signalProcessingThread] Shutting down the LogicalSessionCache
2024-09-04T16:39:46.875+0000 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets...
2024-09-04T16:39:46.879+0000 I NETWORK [listener] removing socket file: /tmp/mongodb-27117.sock
2024-09-04T16:39:46.879+0000 I NETWORK [signalProcessingThread] Shutting down the global connection pool
2024-09-04T16:39:46.879+0000 I STORAGE [signalProcessingThread] Shutting down the FlowControlTicketholder
2024-09-04T16:39:46.879+0000 I - [signalProcessingThread] Stopping further Flow Control ticket acquisitions.
2024-09-04T16:39:46.879+0000 I STORAGE [signalProcessingThread] Shutting down the PeriodicThreadToAbortExpiredTransactions
2024-09-04T16:39:46.879+0000 I STORAGE [signalProcessingThread] Shutting down the PeriodicThreadToDecreaseSnapshotHistoryIfNotNeeded
2024-09-04T16:39:46.879+0000 I REPL [signalProcessingThread] Shutting down the ReplicationCoordinator
2024-09-04T16:39:46.880+0000 I SHARDING [signalProcessingThread] Shutting down the ShardingInitializationMongoD
2024-09-04T16:39:46.880+0000 I REPL [signalProcessingThread] Enqueuing the ReplicationStateTransitionLock for shutdown
2024-09-04T16:39:46.880+0000 I - [signalProcessingThread] Killing all operations for shutdown
2024-09-04T16:39:46.880+0000 I COMMAND [signalProcessingThread] Shutting down all open transactions
2024-09-04T16:39:46.880+0000 I REPL [signalProcessingThread] Acquiring the ReplicationStateTransitionLock for shutdown
2024-09-04T16:39:46.880+0000 I INDEX [signalProcessingThread] Shutting down the IndexBuildsCoordinator
2024-09-04T16:39:46.880+0000 I NETWORK [signalProcessingThread] Shutting down the ReplicaSetMonitor
2024-09-04T16:39:46.880+0000 I CONTROL [signalProcessingThread] Shutting down free monitoring
2024-09-04T16:39:46.880+0000 I CONTROL [signalProcessingThread] Shutting down free monitoring
2024-09-04T16:39:46.880+0000 I FTDC [signalProcessingThread] Shutting down full-time data capture
2024-09-04T16:39:46.880+0000 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture
2024-09-04T16:39:46.882+0000 I STORAGE [signalProcessingThread] Shutting down the HealthLog
2024-09-04T16:39:46.882+0000 I STORAGE [signalProcessingThread] Shutting down the storage engine
2024-09-04T16:39:46.882+0000 I STORAGE [signalProcessingThread] Deregistering all the collections
2024-09-04T16:39:46.883+0000 I STORAGE [signalProcessingThread] Timestamp monitor shutting down
2024-09-04T16:39:46.883+0000 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down
2024-09-04T16:39:46.883+0000 I STORAGE [signalProcessingThread] Shutting down session sweeper thread
2024-09-04T16:39:46.883+0000 I STORAGE [signalProcessingThread] Finished shutting down session sweeper thread
2024-09-04T16:39:46.883+0000 I STORAGE [signalProcessingThread] Shutting down journal flusher thread
2024-09-04T16:39:46.902+0000 I NETWORK [conn3] end connection 127.0.0.1:46386 (6 connections now open)
2024-09-04T16:39:46.902+0000 I NETWORK [conn1] end connection 127.0.0.1:46374 (5 connections now open)
2024-09-04T16:39:46.902+0000 I NETWORK [conn4] end connection 127.0.0.1:46402 (4 connections now open)
2024-09-04T16:39:46.902+0000 I NETWORK [conn5] end connection 127.0.0.1:46414 (3 connections now open)
2024-09-04T16:39:46.903+0000 I NETWORK [conn2] end connection 127.0.0.1:46382 (2 connections now open)
2024-09-04T16:39:46.903+0000 I NETWORK [conn6] end connection 127.0.0.1:46428 (1 connection now open)
2024-09-04T16:39:46.940+0000 I STORAGE [signalProcessingThread] Finished shutting down journal flusher thread
2024-09-04T16:39:46.940+0000 I STORAGE [signalProcessingThread] Shutting down checkpoint thread
2024-09-04T16:39:46.940+0000 I STORAGE [signalProcessingThread] Finished shutting down checkpoint thread
2024-09-04T16:39:46.971+0000 I STORAGE [signalProcessingThread] shutdown: removing fs lock...
2024-09-04T16:39:46.971+0000 I - [signalProcessingThread] Dropping the scope cache for shutdown
2024-09-04T16:39:46.971+0000 I CONTROL [signalProcessingThread] now exiting
2024-09-04T16:39:46.971+0000 I CONTROL [signalProcessingThread] shutting down with code:0
[1]+ Done sudo -u unifi /tmp/mongodb-linux-x86_64-debian10-4.2.23/bin/./mongod --port 27117 --dbpath /var/lib/unifi/db
|
AGGIORNAMENTO DI MONGODB DALLA VERSIONE 4.2.23 ALLA VERSIONE 4.4
Importare la chiave GPG di MongoDB 4.4 con il comando:
0 |
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-4.4.gpg --dearmor
|
ATTENZIONE: è possibile bipassare il check della chiave GPG con il seguente comando:
0 |
sudo apt update --allow-insecure-repositories
|
Quindi aggiungere i sorgenti MongoDB 4.4 al file sources.list con il comando:
NOTA BENE: Rimuovere tutti i repository MongoDB precedenti esistenti
0 |
sudo nano /etc/apt/sources.list
|
Al fondo del file aggiungere il seguente sorgente:
0 |
deb [arch=amd64] https://repo.mongodb.org/apt/debian/ buster/mongodb-org/4.4 main
|
Salvare e chiudere il file dei repository
Aggiornare il repository con il comando:
0 |
sudo apt update
|
Quindi installare la versione MongoDB 4.4 con il comando:
0 |
sudo apt install mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools mongodb-org-database-tools-extra
|
Premere OK per riavviare il servizio di MongoDB
A questo punto avviare il servizio Unifi con il comando:
0 |
sudo systemctl start unifi
|
Terminare quindi l’aggiornamento con il comando:
0 |
mongo --port 27117 --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )'
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
|
MongoDB shell version v4.4.29
connecting to: mongodb://127.0.0.1:27117/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("f809a945-fb14-4659-afeb-c06e7abeb7c0") }
MongoDB server version: 4.4.29
{ "ok" : 1 }
|
Per verificare che l’aggiornamento sia andato a buon fine eseguire il comando:
0 |
mongo --port 27117 --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'
|
Se è andato tutto a buon fine dovremmo visualizzare nell’output del comando le seguenti righe:
0
1
2
|
MongoDB shell version v4.4.29
MongoDB server version: 4.4.29
{ "featureCompatibilityVersion" : { "version" : "4.4" }, "ok" : 1 }
|
Un ulteriore check è quello di verificare se la Web Gui di Unifi è raggiunigibile e se autenticandoci visualizziamo tutta la configurazione presente prima dell’aggiornamento del MongoDB
AGGIORNAMENTO DI MONGODB DALLA VERSIONE 4.4 ALLA VERSIONE 5.0.26
Fermare il servizio Unifi con il comando:
0 |
systemctl stop unifi
|
Scaricare MongoDB Shell con il comando:
ATTENZIONE: MongoDB Shell è deprecato da Mongo 6.0, quindi abbiamo bisogno di un pacchetto separato per
0 |
wget https://downloads.mongodb.com/compass/mongosh-2.2.5-linux-x64.tgz -P /tmp/
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
8
9
|
--2024-09-04 17:04:09-- https://downloads.mongodb.com/compass/mongosh-2.2.5-linux-x64.tgz
Resolving downloads.mongodb.com (downloads.mongodb.com)... 3.164.182.3, 3.164.182.124, 3.164.182.42, ...
Connecting to downloads.mongodb.com (downloads.mongodb.com)|3.164.182.3|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 80612324 (77M) [application/octet-stream]
Saving to: ‘/tmp/mongosh-2.2.5-linux-x64.tgz’
mongosh-2.2.5-linux-x64.tgz 100%[===========================================================>] 76.88M 58.4MB/s in 1.3s
2024-09-04 17:04:11 (58.4 MB/s) - ‘/tmp/mongosh-2.2.5-linux-x64.tgz’ saved [80612324/80612324]
|
Estrarre MongoDB Shell con il comando:
0 |
tar xvzf /tmp/mongosh-2.2.5-linux-x64.tgz -C /tmp/
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
8
|
mongosh-2.2.5-linux-x64/
mongosh-2.2.5-linux-x64/LICENSE-crypt-library
mongosh-2.2.5-linux-x64/LICENSE-mongosh
mongosh-2.2.5-linux-x64/README
mongosh-2.2.5-linux-x64/THIRD_PARTY_NOTICES
mongosh-2.2.5-linux-x64/bin/
mongosh-2.2.5-linux-x64/mongosh.1.gz
mongosh-2.2.5-linux-x64/bin/mongosh
mongosh-2.2.5-linux-x64/bin/mongosh_crypt_v1.so
|
Scaricare MongoDB 5.0.26 con il comando:
0 |
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian11-5.0.26.tgz -P /tmp/
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
8
9
|
--2024-09-04 17:06:16-- https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian11-5.0.26.tgz
Resolving fastdl.mongodb.org (fastdl.mongodb.org)... 18.161.111.14, 18.161.111.6, 18.161.111.104, ...
Connecting to fastdl.mongodb.org (fastdl.mongodb.org)|18.161.111.14|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 87851762 (84M) [application/gzip]
Saving to: ‘/tmp/mongodb-linux-x86_64-debian11-5.0.26.tgz’
mongodb-linux-x86_64-debian11-5.0 100%[===========================================================>] 83.78M 25.3MB/s in 3.3s
2024-09-04 17:06:20 (25.3 MB/s) - ‘/tmp/mongodb-linux-x86_64-debian11-5.0.26.tgz’ saved [87851762/87851762]
|
Estrarre MongoDB 5.0.26 con il comando:
0 |
tar xvzf /tmp/mongodb-linux-x86_64-debian11-5.0.26.tgz -C /tmp/
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
|
mongodb-linux-x86_64-debian11-5.0.26/LICENSE-Community.txt
mongodb-linux-x86_64-debian11-5.0.26/MPL-2
mongodb-linux-x86_64-debian11-5.0.26/README
mongodb-linux-x86_64-debian11-5.0.26/THIRD-PARTY-NOTICES
mongodb-linux-x86_64-debian11-5.0.26/bin/install_compass
mongodb-linux-x86_64-debian11-5.0.26/bin/mongo
mongodb-linux-x86_64-debian11-5.0.26/bin/mongod
mongodb-linux-x86_64-debian11-5.0.26/bin/mongos
|
Avviare MongoDB 5.0.26 in background con il comando:
0 |
sudo -u unifi /tmp/mongodb-linux-x86_64-debian11-5.0.26/bin/./mongod --port 27117 --dbpath /var/lib/unifi/db &
|
Esecuzione della compatibilità delle funzionalità versione 5.0 con il comando:
0 |
/tmp/mongosh-2.2.5-linux-x64/bin/./mongosh --port 27117 --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } ) '
|
Spegnere MongoDB 5.0.26 con il comando:
0 |
/tmp/mongosh-2.2.5-linux-x64/bin/./mongosh --port 27117 --eval 'db.getSiblingDB("admin").shutdownServer({ "timeoutSecs": 60 })'
|
AGGIORNAMENTO DI MONGODB DALLA VERSIONE 5.0.26 ALLA VERSIONE 6.0.15
Scaricare MongoDB 6.0.15 con il comando:
0 |
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian11-6.0.15.tgz -P /tmp/
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
7
8
9
|
--2024-09-04 17:11:27-- https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian11-6.0.15.tgz
Resolving fastdl.mongodb.org (fastdl.mongodb.org)... 18.161.111.6, 18.161.111.14, 18.161.111.104, ...
Connecting to fastdl.mongodb.org (fastdl.mongodb.org)|18.161.111.6|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 72529641 (69M) [application/gzip]
Saving to: ‘/tmp/mongodb-linux-x86_64-debian11-6.0.15.tgz’
mongodb-linux-x86_64-debian11-6.0 100%[===========================================================>] 69.17M 70.9MB/s in 1.0s
2024-09-04 17:11:28 (70.9 MB/s) - ‘/tmp/mongodb-linux-x86_64-debian11-6.0.15.tgz’ saved [72529641/72529641]
|
Estrarre MongoDB 6.0.15 con il comando:
0 |
tar xvzf /tmp/mongodb-linux-x86_64-debian11-6.0.15.tgz -C /tmp/
|
Dovremmo visualizzare il seguente output:
0
1
2
3
4
5
6
|
mongodb-linux-x86_64-debian11-6.0.15/LICENSE-Community.txt
mongodb-linux-x86_64-debian11-6.0.15/MPL-2
mongodb-linux-x86_64-debian11-6.0.15/README
mongodb-linux-x86_64-debian11-6.0.15/THIRD-PARTY-NOTICES
mongodb-linux-x86_64-debian11-6.0.15/bin/install_compass
mongodb-linux-x86_64-debian11-6.0.15/bin/mongod
mongodb-linux-x86_64-debian11-6.0.15/bin/mongos
|
Avviare MongoDB 6.0.15 in background con il comando:
0 |
sudo -u unifi /tmp/mongodb-linux-x86_64-debian11-6.0.15/bin/./mongod --port 27117 --dbpath /var/lib/unifi/db &
|
Esecuzione della compatibilità delle funzionalità versione 6.0 con il comando:
0 |
/tmp/mongosh-2.2.5-linux-x64/bin/./mongosh --port 27117 --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "6.0" } )'
|
Spegnere MongoDB 6.0.15 con il comando:
0 |
/tmp/mongosh-2.2.5-linux-x64/bin/./mongosh --port 27117 --eval 'db.getSiblingDB("admin").shutdownServer({ "timeoutSecs": 60 })'
|
AGGIORNAMENTO DI MONGODB DALLA VERSIONE 6.0.15 ALLA VERSIONE 7.0
Importare la chiave GPG di MongoDB 4.4 con il comando:
0 |
curl -o /etc/apt/trusted.gpg.d/mongodb-org-70.gpg https://pgp.mongodb.com/server-7.0.pub
|
Dobvremmo visualizzare il seguente output:
0
1
2
3
|
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1162 100 1162 0 0 2157 0 --:--:-- --:--:-- --:--:-- 2155
|
Quindi aggiungere i sorgenti MongoDB 7.0 al file sources.list con il comando:
NOTA BENE: Rimuovere tutti i repository MongoDB precedenti esistenti
0 |
sudo nano /etc/apt/sources.list
|
Al fondo del file aggiungere il seguente sorgente:
0 |
deb [arch=amd64] https://repo.mongodb.org/apt/debian/ bullseye/mongodb-org/7.0 main
|
Salvare e chiudere il file dei repository
Aggiornare il repository con il comando:
0 |
sudo apt update
|
Quindi installare la versione MongoDb 7.0 con il comando:
0 |
sudo apt install mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools mongodb-org-database-tools-extra
|
A questo punto avviare il servizio Unifi con il comando:
0 |
sudo systemctl start unifi
|
Terminare quindi l’aggiornamento con il comando:
0 |
mongosh --port 27117 --eval 'db.adminCommand( { setFeatureCompatibilityVersion: "7.0", confirm: true } )'
|
Verificare che l’aggiornamento sia andato a buon fine con il comando:
0 |
mongosh --port 27117 --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )'
|
Dovremmo visualizzare il seguente output:
0 |
{ featureCompatibilityVersion: { version: '7.0' }, ok: 1 }
|
Un ulteriore check è quella di verificare se la Web Gui di Unifi è raggiunigibile e se autenticandoci visualizziamo tutta la configurazione presente prima dell’aggiornamento del MongoDB.
0 commenti