Gestions des Services

Démarrer MongoDB

sudo systemctl start mongod

sudo service mongod start

Vérification du démmarage de MongoDB

sudo systemctl status mongod

sudo service mongod status

● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2020-04-14 22:37:51 CEST; 11s ago
Docs: https://docs.mongodb.org/manual
Main PID: 51202 (mongod)
Memory: 175.5M
CGroup: /system.slice/mongod.service
└─51202 /usr/bin/mongod --config /etc/mongod.conf

Arrêter MongoDB

sudo systemctl stop mongod

sudo service mongod stop

Vérification de l'arret de MongoDB

sudo systemctl status mongod

sudo service mongod status

● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: https://docs.mongodb.org/manual

Lancement Shell Mongo

mongo

MongoDB shell version v4.2.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("939393c4-eeb1-44e7-abef-43a1a5afdc3b") }
MongoDB server version: 4.2.5
Server has startup warnings:
2020-04-15T15:31:01.910+0200 I CONTROL [initandlisten]
2020-04-15T15:31:01.910+0200 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-04-15T15:31:01.910+0200 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2020-04-15T15:31:01.910+0200 I CONTROL [initandlisten]
2020-04-15T15:31:01.910+0200 I CONTROL [initandlisten]
2020-04-15T15:31:01.910+0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2020-04-15T15:31:01.910+0200 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2020-04-15T15:31:01.910+0200 I CONTROL [initandlisten]
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---