MongoDB 安装和使用(zip)
一、MongoDB 准备工作:
1、MongoDB 下载:
1.1、mongodb 下载(version-windows-zip):https://www.mongodb.com/try/download/community
1.2、shell 下载(version-windows-zip):https://www.mongodb.com/try/download/compass
2、建立目录:
2.1、MongoDB安装目录:D:\tools\web\db\mongodb
2.2、MongoDB安装根目录:D:\tools\web\db\mongodb\mongodb_install
2.3、数据存储目录:D:\tools\web\db\mongodb\mongodb_data\data
2.4、日志存储目录:D:\tools\web\db\mongodb\mongodb_data\log\mongod.log
2.5、建立空文件mogod.log:D:\tools\web\db\mongodb\mongodb_data\log\mongod.log
3、配置文件(D:\tools\web\db\mongodb\mongodb602\mongod.cfg)
3.1、yaml入门教程:https://www.runoob.com/w3cnote/yaml-intro.html
3.2、配置文件内容(mongod.cfg):
storage:
dbPath: D:\tools\web\db\mongodb\mongodb_data\data
systemLog:
destination: file
path: D:\tools\web\db\mongodb\mongodb_data\log\mongod.log
4、配置系统环境变量(以追加添加环境变量):
4.1、path = ;D:\tools\web\db\mongodb\mongodb_install\bin;

二、MongoDB:安装服务、服务开启、服务关闭、卸载服务
1、MongoDB:安装服务、服务开启、服务关闭、卸载服务:
1 G:\tmpWorkspaces>mongod --config "D:\tools\web\db\mongodb\mongodb_install\bin\mongod.cfg" --install
2
3 G:\tmpWorkspaces>net start MongoDB
4 The MongoDB service is starting...
5 The MongoDB service was started successfully.
6
7
8 G:\tmpWorkspaces>net stop MongoDB
9 The MongoDB service is stopping.
10 The MongoDB service was stopped successfully.
11
12
13 G:\tmpWorkspaces>mongod --remove
14 {"t":{"$date":"2023-01-27T04:20:06.891+08:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
15 {"t":{"$date":"2023-01-27T04:20:06.899+08:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"thread1","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
16 {"t":{"$date":"2023-01-27T04:20:11.155+08:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"thread1","msg":"Implicit TCP FastOpen in use."}
17 {"t":{"$date":"2023-01-27T04:20:11.161+08:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
18 {"t":{"$date":"2023-01-27T04:20:11.161+08:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
19 {"t":{"$date":"2023-01-27T04:20:11.162+08:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
20 {"t":{"$date":"2023-01-27T04:20:11.162+08:00"},"s":"I", "c":"CONTROL", "id":23307, "ctx":"thread1","msg":"Trying to remove Windows service","attr":{"name":"MongoDB"}}
21 {"t":{"$date":"2023-01-27T04:20:11.180+08:00"},"s":"I", "c":"CONTROL", "id":23312, "ctx":"thread1","msg":"Service removed","attr":{"serviceName":"MongoDB"}}
22
23 G:\tmpWorkspaces>
24 G:\tmpWorkspaces>
2、MongoDB:安装服务、服务开启、服务关闭、卸载服务 (操作实例)

三、MongoDB 使用教程
1、MongoDB 教程(菜鸟教程):https://www.runoob.com/mongodb/mongodb-tutorial.html
本文由 lnlidawei 原创、整理、转载,本文来自于【博客园】; 整理和转载的文章版权归属【原创作者】; 转载或引用时【请保留文章的来源信息】:https://www.cnblogs.com/lnlidawei/p/16793458.html

浙公网安备 33010602011771号