MongoDB 安装和使用
一、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\mongodb602
2.3、数据存储目录:D:\tools\web\db\mongodb\mongodb_data\data
2.4、日志存储目录:D:\tools\web\db\mongodb\mongodb_data\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
二、MongoDB:安装服务、服务开启、服务关闭、卸载服务
1、MongoDB:安装服务、服务开启、服务关闭、卸载服务:
G:\tmpWorkspaces\databases>mongod --config "D:\tools\web\db\mongodb\mongodb602\mongod.cfg" --install {"t":{"$date":"2022-10-14T18:03:15.987Z"},"s":"I", "c":"CONTROL", "id":20697, "ctx":"-","msg":"Renamed existing log file","attr":{"oldLogPath":"D:\\tools\\web\\db\\mongodb\\mongodb_data\\log\\mongod.log","newLogPath":"D:\\tools\\web\\db\\mongodb\\mongodb_data\\log\\mongod.log.2022-10-14T18-03-15"}} G:\tmpWorkspaces\databases>net start MongoDB The MongoDB service is starting.. The MongoDB service was started successfully. G:\tmpWorkspaces\databases>net stop MongoDB The MongoDB service is stopping. The MongoDB service was stopped successfully. G:\tmpWorkspaces\databases>mongod --remove {"t":{"$date":"2022-10-15T02:12:00.988+08:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"} {"t":{"$date":"2022-10-15T02:12:05.315+08:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}} {"t":{"$date":"2022-10-15T02:12:05.316+08:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"thread1","msg":"Implicit TCP FastOpen in use."} {"t":{"$date":"2022-10-15T02:12:05.322+08:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}} {"t":{"$date":"2022-10-15T02:12:05.322+08:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}} {"t":{"$date":"2022-10-15T02:12:05.322+08:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}} {"t":{"$date":"2022-10-15T02:12:05.323+08:00"},"s":"I", "c":"CONTROL", "id":23307, "ctx":"thread1","msg":"Trying to remove Windows service","attr":{"name":"MongoDB"}} {"t":{"$date":"2022-10-15T02:12:05.325+08:00"},"s":"I", "c":"CONTROL", "id":23312, "ctx":"thread1","msg":"Service removed","attr":{"serviceName":"MongoDB"}} G:\tmpWorkspaces\databases>
2、MongoDB:安装服务、服务开启、服务关闭、卸载服务 (操作实例)
三、MongoDB 使用教程
1、MongoDB 教程(菜鸟教程):https://www.runoob.com/mongodb/mongodb-tutorial.html
标签:web,log,MongoDB,使用,db,tools,mongodb,安装 From: https://www.cnblogs.com/lnlidawei/p/16793458.html