首页 > 数据库 > MongoDB: MongoDB 安装和使用

MongoDB: MongoDB 安装和使用

时间:2022-10-15 02:44:05浏览次数:48  
标签:web log MongoDB 使用 db tools mongodb 安装

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

相关文章

  • 实验一 C 语言开发环境使用和数据类型,运算符,表达式
      #include<stdio.h>#include<stdlib.h>intmain(){printf("OO\n");printf("<H><H>\n");printf("II II\n");sys......
  • Windows安装Redis的流程
    1.下载下载地址:https://github.com/tporadowski/redis/releases 2.解压新建一个文件夹为redis-5.0.10,然后将下载好的zip包解压到新建的redis-5.0.10文件夹中。 3......
  • CentOS7脚本安装GitLab
    #!/bin/bashyuminstall-ycurlpolicycoreutils-pythonopenssh-serverperlsystemctlenablesshdsystemctlstartsshdfirewall-cmd--permanent--add-service=httpfi......
  • JavaFx 使用字体图标记录
    原文:JavaFx使用字体图标记录-Stars-One的杂货小窝之前其实也是研究过关于字体图标的使用,还整了个库Tornadofx学习笔记(4)——IconTextFx开源库,整合5000+个字体图标......
  • 实验1:C语言开发环境使用和编程初体验
     任务一:#include<stdio.h>#include<stdlib.h>intmain(){printf("00\n");printf("<H><H>\n");printf("III......
  • 使用Windows命令行打开任务计划程序
    1.点击“Win+R”,打开运行对话框。2.输入“CMD”,然后点击“确定”按钮。3.输入“taskschd.msc”或“taskschd”命令,然后点击回车。4.可以看到任务计划程序已经打开。......
  • ALL IN ONE之Openwrt安装
    1.openwrt固件下载Openwrt在线定制编译登录上边的网址,设备型号选择【Genericx86/64】,常用软件包根据自己的需求选择,其他根据需要填写,点击构建固件,构建完成后,下载即可2.......
  • JDownloader下载工具的安装
    JDownloader下载工具的安装JDownloader是一个免费的、开放源码的下载管理工具,它有一个庞大的交流社区。用户可以启动,停止或暂停下载,设置带宽限制,自动提取档案等等。个人......
  • 使用数据透视表,完成对不同分类数据的单独排名!
    Excel情报局职场联盟Excel生产挖掘分享Excel基础技能Excel爱好者大本营用1%的Excel基础搞定99%的职场问题做一个超级实用的Excel公众号Excel是门手艺玩转需要勇气数万Excel......
  • vue-preview图片预览组件的使用
    一、运行命令`npmivue-preview `安装插件。二、在main.js里面进行全局声明。 三、插入缩略图,imgs1为定义的用于存储缩略图数据的属性。   四、获取数据......