mongodb卸载

Today we will learn how to install MongoDB on Windows. Most of us use Windows for our personal use. That’s why I am writing this tutorial to help you install MongoDB on Windows. We will also learn how to start and uninstall MongoDB on Windows.

今天,我们将学习如何在Windows上安装MongoDB。 我们大多数人都将Windows用于个人用途。 这就是为什么我编写本教程来帮助您在Windows上安装MongoDB的原因。 我们还将学习如何在Windows上启动和卸载MongoDB。

Windows版MongoDB (MongoDB for Windows)

Starting from MongoDB version 2.2, MongoDB doesn’t support Windows XP. So if you are on Windows XP, either upgrade it or use the lower versions of MongoDB. This tutorial is intended to help you in installing MongoDB on Windows latest versions i.e Windows 7 and Windows 8, 8.1 etc.

从MongoDB 2.2版开始,MongoDB不支持Windows XP。 因此,如果您使用的是Windows XP,请升级它或使用较低版本的MongoDB。 本教程旨在帮助您在Windows最新版本(例如Windows 7和Windows 8、8.1等)上安装MongoDB。

在Windows上安装MongoDB (Install MongoDB on Windows)

Follow below steps to perform the installation of MongoDB into your windows system.

请按照以下步骤将MongoDB安装到Windows系统中。

  1. Consider specific MongoDB build type which you need actually

    Three build types of MongoDB for Windows are available.

    1. MongoDB for Windows Server 2008 R2 series: This build type runs only on 2008R2, Windows 7 64-bit, Windows 8, and latest versions of Windows.
    2. MongoDB for Windows 64-bit: This build type of MongoDB runs on any 64-bit version of Windows latest than Windows XP, involve Windows Server 2008 R2 and Windows 7 64-bit.
    3. MongoDB for Windows 32-bit: MongoDB runs on any 32-bit version of Windows latest than Windows XP, 32-bit version of MongoDB are only designed for older system and use for testing and developing systems. Windows 32-bit versions of MongoDB support only database smaller than 2GB.

    If you want to know that which specific version of windows you are running at your system, then simply use following command on command prompt.

    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.C:\Users\Pankaj>wmic os get osarchitecture
    OSArchitecture
    64-bitC:\Users\Pankaj>

    考虑您实际需要的特定MongoDB构建类型

    适用于Windows的三种MongoDB构建类型。

    1. Windows Server 2008 R2系列的MongoDB :此构建类型仅在2008R2,Windows 7 64位,Windows 8和Windows的最新版本上运行。
    2. 适用于Windows 64位的MongoDB:此MongoDB的构建类型可在Windows XP以外的任何64位版本的Windows上运行,涉及Windows Server 2008 R2和Windows 7 64位。
    3. 适用于Windows 32位版的MongoDB:MongoDB可以在Windows XP以外的任何32位版本的Windows上运行,MongoDB的32位版本仅适用于较旧的系统,并用于测试和开发系统。 Windows 32位版本的MongoDB仅支持小于2GB的数据库。

    如果您想知道系统上正在运行Windows的特定版本,则只需在命令提示符下使用以下命令。

  2. Download MongoDB for Windows

    Download the latest version release from the MongoDB Download page. Make sure you download the latest version of MongoDB for your Windows. Note that 64-bit versions of MongoDB do not run with 32-bit Windows.

    下载Windows版MongoDB

    从MongoDB下载页面下载最新版本。 确保为Windows下载了最新版本的MongoDB。 请注意,MongoDB的64位版本不能在32位Windows上运行。

  3. MongoDB Installation Options

    In Windows Explorer, simply locate downloaded MongoDB msi file, then Double-click the msi file. A series of screens will guide you through the installation procedure. There are multiple options such as Typical, Custom and Complete installation. MongoDB default installation goes into Program Files, so if you want to change it then go for Custom installation.

    MongoDB安装选项

    在Windows资源管理器中,只需找到下载的MongoDB msi文件,然后双击该msi文件。 一系列屏幕将指导您完成安装过程。 有多个选项,例如“典型”,“自定义”和“完整”安装。 MongoDB默认安装进入“程序文件”,因此,如果要更改它,则进行“自定义”安装。

  4. MongoDB installation folder move to another location (Optional)

    Sometimes we want to move the installation to another directory, we can use move command for this. This command needs to be run as administrator. For example, to move the folder to C:\MongoDB follow the steps shown in below images.

    MongoDB does not depend at any other system because it is self contained. You can execute MongoDB from the folder of your choice and can install it in any folder (for, example D:\test\mongodb)

    MongoDB安装文件夹移至另一个位置(可选)

    有时我们想将安装移动到另一个目录,为此可以使用move命令。 该命令需要以管理员身份运行。 例如,要将文件夹移动到C:\ MongoDB,请按照下图所示的步骤进行操作。

    MongoDB不依赖于任何其他系统,因为它是独立的。 您可以从您选择的文件夹中执行MongoDB,并将其安装在任何文件夹中(例如D:\ test \ mongodb)

运行MongoDB服务器 (Running MongoDB Server)

We need to create a directory where MongoDB server will store all it’s data. The MongoDB default data directory path is \data\db. Make this folder using the following commands from Command Prompt. Note that if the directory doesn’t exists, MongoDB will try to create it. But it’s good to create it before hand.

我们需要创建一个目录,MongoDB服务器将在其中存储所有数据。 MongoDB的默认数据目录路径为\ data \ db。 使用命令提示符中的以下命令创建此文件夹。 请注意,如果该目录不存在,MongoDB将尝试创建它。 但是事先创建它是很好的。

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.C:\Users\Pankaj>cd \C:\>md \data\dbC:\>

To start MongoDB server, we need to run mongod.exe. For example, from the Command Prompt;

要启动MongoDB服务器,我们需要运行mongod.exe。 例如,从命令提示符;

C:\>C:\MongoDB\bin\mongod.exe

This MongoDB starts the main databases process. The waiting for connection message in the console results determines that the mongod.exe process is complete.

此MongoDB启动主数据库过程。 控制台结果中的等待连接消息确定mongod.exe进程已完成。

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.C:\Users\Pankaj>cd \C:\>MongoDB\bin\mongod.exe
MongoDB\bin\mongod.exe --help for help and startup options
2014-11-11T13:36:19.016+0530 [initandlisten] MongoDB starting : pid=5292 port=27
017 dbpath=\data\db\ 64-bit host=Meghna
2014-11-11T13:36:19.017+0530 [initandlisten] targetMinOS: Windows 7/Windows Serv
er 2008 R2
2014-11-11T13:36:19.017+0530 [initandlisten] db version v2.6.5
2014-11-11T13:36:19.017+0530 [initandlisten] git version: e99d4fcb4279c0279796f2
37aa92fe3b64560bf6
2014-11-11T13:36:19.017+0530 [initandlisten] build info: windows sys.getwindowsv
ersion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1')
BOOST_LIB_VERSION=1_49
2014-11-11T13:36:19.017+0530 [initandlisten] allocator: system
2014-11-11T13:36:19.017+0530 [initandlisten] options: {}
2014-11-11T13:36:19.092+0530 [initandlisten] journal dir=\data\db\journal
2014-11-11T13:36:19.094+0530 [initandlisten] recover : no journal files present,no recovery needed
2014-11-11T13:36:19.186+0530 [initandlisten] allocating new ns file \data\db\loc
al.ns, filling with zeroes...
2014-11-11T13:36:20.002+0530 [FileAllocator] allocating new datafile \data\db\lo
cal.0, filling with zeroes...
2014-11-11T13:36:20.003+0530 [FileAllocator] creating directory \data\db\_tmp
2014-11-11T13:36:20.031+0530 [FileAllocator] done allocating datafile \data\db\l
ocal.0, size: 64MB,  took 0.018 secs
2014-11-11T13:36:20.035+0530 [initandlisten] build index on: local.startup_log p
roperties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "local.startup_log" }
2014-11-11T13:36:20.036+0530 [initandlisten]     added index to empty collection2014-11-11T13:36:20.037+0530 [initandlisten] command local.$cmd command: create
{ create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0numYields:0  reslen:37 851ms
2014-11-11T13:36:20.038+0530 [initandlisten] waiting for connections on port 270
17

You can use a different path for data files using the –dbpath option to mongod.exe, for example:

您可以使用mongod.exe的–dbpath选项为数据文件使用其他路径,例如:

C:\>C:\MongoDB\bin\mongod.exe --dbpath D:\test\mongodb\data

If your path contains white spaces, then you need to use double quotes as shown below.

如果路径中包含空格,则需要使用双引号,如下所示。

C:\>C:\MongoDB\bin\mongod.exe --dbpath "D:\test\mongo db data"

The security level depends on your system configurations, Windows provide pop up a Security Alert dialog box about blocking few features of C:\Folder Name\MongoDB\bin\mongod.exe from communication on networks.

安全级别取决于您的系统配置,Windows提供弹出的“安全警报”对话框,用于阻止C:\Folder Name\MongoDB\bin\mongod.exe功能阻止网络通信。

All the clients should choose Private Networks. For example, my home or work network and click Allow access. For more information on security and MongoDB, please look into the Security Documentation.

所有客户端都应选择专用网络。 例如,我的家庭或工作网络,然后单击“允许访问”。 有关安全性和MongoDB的更多信息,请查看安全性文档。

通过命令提示符连接到MongoDB服务器 (Connecting to MongoDB server through Command Prompt)

We can connect to MongoDB server through mongo.exe client application, just open another command prompt and execute it.

我们可以通过mongo.exe客户端应用程序连接到MongoDB服务器,只需打开另一个命令提示符并执行它即可。

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.C:\Users\Pankaj>C:\MongoDB\bin\mongo.exe
MongoDB shell version: 2.6.5
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, seehttps://docs.mongodb.org/
Questions? Try the support grouphttps://groups.google.com/group/mongodb-user
>

That’s it, once connected we can issue any MongoDB shell commands. To close the client connection, just fire “exit” command or simply close the command prompt.

就是这样,一旦连接,我们就可以发出任何MongoDB shell命令。 要关闭客户端连接,只需触发“退出”命令或直接关闭命令提示符即可。

MongoDB作为Windows服务 (MongoDB as Windows Service)

The problem with above installation is that we need to start MongoDB server manually and then keep the command prompt open. The solution is to configure it as Windows service, so that it can start as soon as system is up and running. Since it will be running in background, there is no need to keep command prompt open.

上面安装的问题是我们需要手动启动MongoDB服务器,然后保持命令提示符打开。 解决方案是将其配置为Windows服务,以便它可以在系统启动并运行后立即启动。 由于它将在后台运行,因此无需保持命令提示符打开。

Before we configure our MongoDB installation as Windows service, let’s create a configuration file for the MongoDB logs.

在将MongoDB安装配置为Windows服务之前,让我们为MongoDB日志创建一个配置文件。

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.C:\Users\Pankaj>cd \C:\>md MongoDB-logs

Now using echo command we can create a configuration file. If you get any permission issues, then run the command prompt as administrator.

现在,使用echo命令,我们可以创建一个配置文件。 如果遇到任何权限问题,请以管理员身份运行命令提示符。

C:\WINDOWS\system32>echo logpath=C:\MongoDB-logs\mongo.log > C:\MongoDB\mongod.conf

Now run below command as administrator to setup MongoDB as service.

现在以管理员身份在命令下方运行,以将MongoDB设置为服务。

C:\>C:\MongoDB\bin\mongod.exe --config C:\MongoDB\mongod.conf --installC:\>

If you want to change MongoDB server port or any other configurations, then you can provide them in the above configuration file.

如果要更改MongoDB服务器端口或任何其他配置,则可以在上述配置文件中提供它们。

If you want to install services for multiple example of mongod.exe, install every service with a unique –serviceName and –serviceDisplayName. Use the multiple examples only when sufficient system resources exist and your design requires it.

如果要为mongod.exe的多个示例安装服务,请使用唯一的–serviceName和–serviceDisplayName安装每个服务。 仅当存在足够的系统资源并且您的设计需要它时,才使用多个示例。

卸载MongoDB Windows (Uninstall MongoDB Windows)

If you want to remove the MongoDB service, then run below command as administrator.

如果要删除MongoDB服务,请以管理员身份在命令下方运行。

C:\>C:\MongoDB\bin\mongod.exe --config C:\MongoDB\mongod.conf --removeC:\>

That’s all for installing MongoDB on Windows and running it as Windows service. We will look into different MongoDB commands in coming posts.

这就是在Windows上安装MongoDB并将其作为Windows服务运行的全部内容。 我们将在后续文章中研究不同的MongoDB命令。

翻译自: https://www.journaldev.com/6128/install-mongodb-windows-start-uninstall

mongodb卸载

mongodb卸载_如何在Windows上安装MongoDB,启动,卸载相关推荐

  1. python联想_联想电脑python安装教程_如何在windows上安装python

    如何在windows上安装python 方法如下: 首根据Windows版本(64位32位)从Python的官方网站下载Python 3.5的64装程序或32位安装程序. 然后,运行下载的EXE安装包 ...

  2. java 中window_教你如何在windows上安装Java

    最近够倒霉的,电脑硬盘坏了,重新做了个系统,各种环境全都没了,/(ㄒoㄒ)/~~ 然后我发现自己在重新安装各种环境的时候,有些东西竟然还需要去查,所以决定把这些环境的配置都写成博客记录下来. 今天就教 ...

  3. 如何在 Windows 上安装多个 MySQL,实现 MySQL 跨电脑移植使用

    如何在 Windows 上安装多个 MySQL,实现 MySQL 跨电脑移植使用 初次安装 MySQL 移植使用 附录 其它 MySQL 命令 查看本 MySQL 数据存放目录 MySQL 的各种其它 ...

  4. 如何在windows上搭建mysql_如何在Windows上安装多个MySQL

    [IT168 技术文档]本文以免安装版的mysql(Without installer)为例,对如何在Windows上安装多个MySQL进行讲解. 免安装版的mysql(Without install ...

  5. 如何在 Windows 上安装 ONLYOFFICE 文档 v7.2

    通过阅读本文,了解如何在Windows上安装ONLYOFFICE文档v7.2. 引言 使用社区版,您可以在本地服务器上安装 ONLYOFFICE 文档,并将在线编辑器与 ONLYOFFICE 协作平台 ...

  6. 如何在windows上安装虚拟机

    如何在windows上安装虚拟机 1.以win10为例子 2.下载虚拟机安装包 3.密钥激活 1.以win10为例子 2.下载虚拟机安装包 链接: https://my.vmware.com/web/ ...

  7. 如何在 Windows 上安装 ONLYOFFICE 文档 v7.3

    通过阅读本文,了解如何在 Windows 上安装 ONLYOFFICE 文档 v7.3. ONLYOFFICE 文档是什么 ONLYOFFICE 文档是一个在线办公套件,包括文本文档.电子表格和演示文 ...

  8. windows 安装php_如何在Windows上安装PHP

    windows 安装php We've previously shown you how to get a working local installation of Apache on your W ...

  9. 2019最新Windows上安装并启动ElasticSearch6.5.4

    在Windows上安装和启动Elastic Search 1.安装JDK,至少1.8.0_73以上版本,java -version 2.下载和解压缩Elasticsearch安装包,官网:https: ...

最新文章

  1. 在Dos下运行exe程序的时候出现找不到Cygwin1.dll文件的情况总结
  2. Java各类型变量之间的转换
  3. 04_有序清单无序清单
  4. java 考试复习整理——JAVA类和类成员的修饰符
  5. OpenJDK8基础类库包清单
  6. 分布式选举协议:Raft
  7. 互联网金融盯上房地产资金饥渴症
  8. linux 软件_RansomExx勒索软件现在也针对Linux系统
  9. 他:32岁,公司骨干技术,月薪1万,加班猝死
  10. 如何检查python模块的版本?
  11. java中list,set,map集合的区别,及面试要点
  12. 利用iptables实现SNAT及DNAT
  13. MySQL之Got fatal error 1236 from master when reading data from binary log
  14. android 界面置顶,Android实现界面滚动时顶部部分内容置顶(附源码)
  15. getch()函数怎么用
  16. 如何使用Blender建模“苹果”
  17. 经典同步时序逻辑电路分析汇总(第八道)(同步三进制计数器)
  18. VMX(1) -- 简介
  19. 加州欧文计算机工程专业,加州大学欧文分校计算机工程博士专业排名
  20. Angular: ‘ng’ is not recognized as an internal or external command, operable program or batch file

热门文章

  1. Java八种基本数据类型的大小,以及封装类,自动装箱/拆箱的用法?
  2. Asp.net实现MVC处理文件的上传下载删除功能实例教程
  3. [转载] python仿真入门_python基础-入门
  4. [转载] Java 中的binarySearch方法
  5. RTM-DSP项目总结
  6. JavaWeb之多语言国际化
  7. PHP安全之Web攻击
  8. 第三章:什么是组织结构
  9. Android系统中震动功能的测试
  10. [cpp] 重载运算符规律总结