MongoDB: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
| Line 50: | Line 50: | ||
|   mongosh |   mongosh | ||
| == Configuration == | |||
|  /etc/mongod.conf | |||
| default: | |||
| <pre> | |||
| # mongod.conf | |||
| # for documentation of all options, see: | |||
| #   http://docs.mongodb.org/manual/reference/configuration-options/ | |||
| # Where and how to store data. | |||
| storage: | |||
|   dbPath: /var/lib/mongodb | |||
| #  engine: | |||
| #  wiredTiger: | |||
| # where to write logging data. | |||
| systemLog: | |||
|   destination: file | |||
|   logAppend: true | |||
|   path: /var/log/mongodb/mongod.log | |||
| # network interfaces | |||
| net: | |||
|   port: 27017 | |||
|   bindIp: 127.0.0.1 | |||
| # how the process runs | |||
| processManagement: | |||
|   timeZoneInfo: /usr/share/zoneinfo | |||
| #security: | |||
| #operationProfiling: | |||
| #replication: | |||
| #sharding: | |||
| ## Enterprise-Only Options: | |||
| #auditLog: | |||
| </pre> | |||
| == Uninstall MongoDB == | == Uninstall MongoDB == | ||
Revision as of 23:15, 22 May 2024
MongoDB
MongoDB https://www.mongodb.com/
Install MongoDB Community Edition
sudo apt-get install gnupg curl
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ --dearmor
# Ubuntu 20: echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
# Ubuntu 22: echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
Prevent unintended upgrades: (pin)
echo "mongodb-org hold" | sudo dpkg --set-selections echo "mongodb-org-database hold" | sudo dpkg --set-selections echo "mongodb-org-server hold" | sudo dpkg --set-selections echo "mongodb-mongosh hold" | sudo dpkg --set-selections echo "mongodb-org-mongos hold" | sudo dpkg --set-selections echo "mongodb-org-tools hold" | sudo dpkg --set-selections
ref:
Install MongoDB Community Edition on Ubuntu - MongoDB Manual v7.0 https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/
Manage MonoDB Service
sudo systemctl start mongod sudo systemctl daemon-reload sudo systemctl status mongod sudo systemctl enable mongod sudo systemctl stop mongod sudo systemctl restart mongod
Port 27017
port 27017
mongosh
mongosh
Configuration
/etc/mongod.conf
default:
# mongod.conf # for documentation of all options, see: # http://docs.mongodb.org/manual/reference/configuration-options/ # Where and how to store data. storage: dbPath: /var/lib/mongodb # engine: # wiredTiger: # where to write logging data. systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log # network interfaces net: port: 27017 bindIp: 127.0.0.1 # how the process runs processManagement: timeZoneInfo: /usr/share/zoneinfo #security: #operationProfiling: #replication: #sharding: ## Enterprise-Only Options: #auditLog:
Uninstall MongoDB
Stop service:
sudo service mongod stop
Remove packages:
sudo apt-get purge "mongodb-org*"
Remove Data directories:
sudo rm -r /var/log/mongodb sudo rm -r /var/lib/mongodb