From 3327e79fc135bd0e1ad2c0af9607f0e305963275 Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Mon, 11 Jun 2012 10:01:22 -0400 Subject: [PATCH 1/3] DOCS-155 Initial version of Windows install guide rewrite --- .../tutorial/install-mongodb-on-windows.txt | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 source/tutorial/install-mongodb-on-windows.txt diff --git a/source/tutorial/install-mongodb-on-windows.txt b/source/tutorial/install-mongodb-on-windows.txt new file mode 100644 index 00000000000..a5313bf3ddf --- /dev/null +++ b/source/tutorial/install-mongodb-on-windows.txt @@ -0,0 +1,143 @@ +========================== +Install MongoDB on Windows +========================== + +.. default-domain:: mongodb + +Synopsis +-------- + +This tutorial outlines the basic installation process for +:term:`MongoDB` on Microsoft Windows systems. This +tutorial provides a basic method for installing and running the +MongoDB server (i.e. ":program:`mongod.exe`") and associated tools. + +Downloading MongoDB for Windows +------------------------------- + +Download the latest production release of MongoDB. The various MongoDB +binaries can be downloaded `here. `_ + +.. note:: + + Ensure you download the proper version of MongoDB for your version + of Windows. The 64-bit version of MongoDB will not work in 32-bit + version of Windows. You can find the version of your Windows system + using this `guide. `_ + + The 32-bit versions of MongoDB are suitable for testing and + evaluation purposes but cannot use databases larger than 3GB. + +Once the download is complete, use Windows Explorer to find the +MongoDB download file (typically in the default Downloads directory) +and extract the archive to ``C:\`` by right clicking on the +archive and selecting "Extract All" and browsing to: ``C:\`` + +.. note:: + + The folder name will be in the format: + + mongodb-win32-ARCH-VERSION + + where ARCH is the 32-bit/64-bit version of MongoDB and VERSION is + the version of MongoDB + +Start the Command Prompt (Start Menu -> All Programs -> Accessories -> +Command Prompt) by right clicking and selecting 'Run as +Administrator' from the popup menu. In the Command Prompt, run commands: + +.. code-block:: sh + + cd \ + rename C:\mongodb-win32-* C:\mongodb + +.. note:: + + MongoDB is self-contained and do not have any other system + dependencies. You can run MongoDB from any folder you choose. One + may install MongoDB in a different directory such as: + ``D:\test\mongodb`` + +Creating data Folder +~~~~~~~~~~~~~~~~~~~~ + +By default, MongoDB uses ``C:\data\db`` to write and store data +files. Create this folder in C:\ in the Command Prompt using the +following commands: + +.. code-block:: sh + + mkdir data + mkdir data\db + +If this folder does not exist, MongoDB will not start. + +.. note:: + + You can specify an alternate path for data\db folder using the + :option:`--dbpath ` option to + :program:`mongod`. To start mongod.exe with another file path, use + the command: ``C:\mongodb\bin\mongod.exe --dbpath + d:\test\mongodb\data`` + + +Starting MongoDB +~~~~~~~~~~~~~~~~ + +To start MongoDB, execute from the Command Prompt: + +.. code-block:: sh + + C:\mongodb\bin\mongod.exe + +This will start the main MongoDB database process. To connect using +the ``mongo.exe`` open another Command Prompt and execute: + +.. code-block:: sh + + C:\mongodb\bin\mongo.exe + +.. note:: + + Executing command: ``start C:\mongodb\bin\mongo.exe`` will + automatically start MongoDB in a separate Command Prompt. + +This will connect to the database running on the localhost interface +and port 27017 by default. At the :program:`mongo.exe` prompt, issue +the following two commands to insert a record in the "test" +:term:`collection` of the (default) "test" database and then retrieve +that record: + +.. code-block:: javascript + + > db.test.save( { a: 1 } ) + > db.test.find() + +Additional MongoDB guides to help you get started: + + .. Documentation for getting started with MongoDB: + + .. - :doc:`/getting-started` + .. STUB - :doc:`/tutorial/insert-test-data-into-a-mongodb-database` + + + +.. how do we use this?? +:program:`mongod.exe` +:program:`mongo.exe` +:program:`mongos.exe` + +Production Use +~~~~~~~~~~~~~~ + +If you're deploying MongoDB on a Windows server for production use, +you may want to use the [whatever you call it]. + +Do this... + +.. code-block:: sh + +TODO simple service example. + + + From 0d5fad86765daebebe9e6425b5d1538ef67adc04 Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Tue, 12 Jun 2012 17:15:40 -0400 Subject: [PATCH 2/3] DOCS-155 Windows Installation Tutorial --- .../tutorial/install-mongodb-on-windows.txt | 201 +++++++++++++----- 1 file changed, 143 insertions(+), 58 deletions(-) diff --git a/source/tutorial/install-mongodb-on-windows.txt b/source/tutorial/install-mongodb-on-windows.txt index a5313bf3ddf..9ed49d123b5 100644 --- a/source/tutorial/install-mongodb-on-windows.txt +++ b/source/tutorial/install-mongodb-on-windows.txt @@ -12,41 +12,68 @@ This tutorial outlines the basic installation process for tutorial provides a basic method for installing and running the MongoDB server (i.e. ":program:`mongod.exe`") and associated tools. -Downloading MongoDB for Windows -------------------------------- +MongoDB for Windows +------------------- -Download the latest production release of MongoDB. The various MongoDB -binaries can be downloaded `here. `_ +MongoDB for Windows is very similar to it MongoDB for other +platforms. MongoDB components work in the same way and with similar +parameters to MongoDB for other platforms. This tutorial will guide +you to install MongoDB on Windows through the :guilabel:`Command +Shell` and setting up MongoDB as a :guilabel:`Windows Service`. + +Download MongoDB for Windows +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Download the latest production release of MongoDB from `here. `_ .. note:: - Ensure you download the proper version of MongoDB for your version - of Windows. The 64-bit version of MongoDB will not work in 32-bit - version of Windows. You can find the version of your Windows system - using this `guide. `_ + Ensure you download the proper version of MongoDB for your + architecture of Windows. The 64-bit version of MongoDB will not + work in 32-bit Windows. The 32-bit versions of MongoDB are suitable for testing and - evaluation purposes but cannot use databases larger than 3GB. + evaluation purposes but cannot use databases larger than 2GB. + + The architecture of your version of Windows can be found using this + command in the :guilabel:`Command Shell` + + .. code-block:: powershell + + wmic os get osarchitecture -Once the download is complete, use Windows Explorer to find the -MongoDB download file (typically in the default Downloads directory) -and extract the archive to ``C:\`` by right clicking on the -archive and selecting "Extract All" and browsing to: ``C:\`` +In Windows Explorer, find the MongoDB download file, typically in the +default Downloads directory, and extract the archive to ``C:\`` by +right clicking on the archive and selecting :guilabel:`Extract All` +and browsing to: ``C:\`` .. note:: - The folder name will be in the format: + The folder name will be either: + + .. code-block:: powershell + + C:\mongodb-win32-i386-[version] + + Or: + + .. code-block:: powershell + + C:\mongodb-win32-x86_64-[version] - mongodb-win32-ARCH-VERSION + In both examples, replace ``[version]`` with the version of MongoDB + downloaded. - where ARCH is the 32-bit/64-bit version of MongoDB and VERSION is - the version of MongoDB +Set up the environment +~~~~~~~~~~~~~~~~~~~~~~ -Start the Command Prompt (Start Menu -> All Programs -> Accessories -> -Command Prompt) by right clicking and selecting 'Run as -Administrator' from the popup menu. In the Command Prompt, run commands: +Start the :guilabel:`Command Shell` by selecting the :guilabel:`Start +Menu`, then :guilabel:`All Programs`, then :guilabel:`Accessories`, +then right click :guilabel:`Command Shell`, and select :guilable:'Run +as Administrator' from the popup menu. In the :guilabel:`Command Shell`, +issue the following commands: -.. code-block:: sh +.. code-block:: powershell cd \ rename C:\mongodb-win32-* C:\mongodb @@ -58,54 +85,72 @@ Administrator' from the popup menu. In the Command Prompt, run commands: may install MongoDB in a different directory such as: ``D:\test\mongodb`` -Creating data Folder -~~~~~~~~~~~~~~~~~~~~ +By default, MongoDB requires a data folder to store files. By default +this is: ``C:\data\db``. Create this folder in ``C:\`` in the +:guilabel:`Command Shell` by issuing the following commands -By default, MongoDB uses ``C:\data\db`` to write and store data -files. Create this folder in C:\ in the Command Prompt using the -following commands: - -.. code-block:: sh +.. code-block:: powershell mkdir data mkdir data\db -If this folder does not exist, MongoDB will not start. - .. note:: You can specify an alternate path for data\db folder using the :option:`--dbpath ` option to :program:`mongod`. To start mongod.exe with another file path, use - the command: ``C:\mongodb\bin\mongod.exe --dbpath - d:\test\mongodb\data`` + the command: + + .. code-block:: powershell + C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data -Starting MongoDB -~~~~~~~~~~~~~~~~ -To start MongoDB, execute from the Command Prompt: +Start MongoDB for Windows +~~~~~~~~~~~~~~~~~~~~~~~~~ -.. code-block:: sh +To start MongoDB, execute from the :guilabel:`Command Shell`: + +.. code-block:: powershell C:\mongodb\bin\mongod.exe -This will start the main MongoDB database process. To connect using -the ``mongo.exe`` open another Command Prompt and execute: +This will start the main MongoDB database process. + +.. note:: + + Depending on the security level of your system, Windows will issue + a :guilabel:`Security Alert` dialog box about blocking "some + features" of ``C:\\mongodb\bin\mongod.exe`` from communicating on + networks. All users should select ``Private Networks, such as my + home or work network`` and click ``Allow access``. For additional + information on security and MongoDB, please read the + :wiki:`Security and Authentication ` + wiki page. + +.. warning:: + + Do not make :program:`mongod.exe` accessible to public networks + without authentication (i.e. :setting:`auth`) on a public + network. MongDB is designed to work within secured networks and + will accept connections without authentication. + +To connect to MongoDB using the :program:`mongo.exe`, open another +:guilabel:`Command Shell` and issue command: -.. code-block:: sh +.. code-block:: powershell C:\mongodb\bin\mongo.exe .. note:: Executing command: ``start C:\mongodb\bin\mongo.exe`` will - automatically start MongoDB in a separate Command Prompt. + automatically start MongoDB in a separate :guilabel:`Command Shell`. This will connect to the database running on the localhost interface -and port 27017 by default. At the :program:`mongo.exe` prompt, issue -the following two commands to insert a record in the "test" -:term:`collection` of the (default) "test" database and then retrieve +and port ``27017`` by default. At the :program:`mongo.exe` prompt, issue +the following two commands to insert a record in the ``test`` +:term:`collection` of the default ``test`` database and then retrieve that record: .. code-block:: javascript @@ -113,31 +158,71 @@ that record: > db.test.save( { a: 1 } ) > db.test.find() -Additional MongoDB guides to help you get started: +.. seealso:: ":program:`mongo`" and ":doc:`/reference/javascript`" + + +MongoDB as Windows Service +-------------------------- + +.. versionadded:: 2.1.1 + +Setup MongoDB to be a :guilabel:`Windows Service`, starting +automatically with each reboot. + +Configure Windows Service Options +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You must specify two options when running MongoDB as a Windows +Service: a directory for the log output and a :doc:`configuration file +`. + +#. Create a specific directory for MongoDB log files: + + .. code-block:: powershell + + mkdir C:\mongodb\log + +#. Create a configuration file for the logpath option for MongoDB in + the :guilabel:`Command Shell` by issuing this command: + + .. code-block:: powershell + + echo logpath=C:\mongodb\log > C:\mongodb\mongodb.cfg + + +To Install and Run the MongoDB Service +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Run all of the following commands in :guilabel:`Command Shell` with +"Administrative Privileges:" + +#. To install the MongoDB service: + + .. code-block:: powershell + + C:\mongodb\bin\mongod.exe --config C:\mongodb\mongodb.cfg --install + +#. To run the MongoDB Service: - .. Documentation for getting started with MongoDB: + .. code-block:: powershell - .. - :doc:`/getting-started` - .. STUB - :doc:`/tutorial/insert-test-data-into-a-mongodb-database` + net start MongoDB +To Stop or Remove the MongoDB Service +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#. To stop MongoDB Service: -.. how do we use this?? -:program:`mongod.exe` -:program:`mongo.exe` -:program:`mongos.exe` + .. code-block:: powershell -Production Use -~~~~~~~~~~~~~~ + net stop MongoDB -If you're deploying MongoDB on a Windows server for production use, -you may want to use the [whatever you call it]. +#. To remove MongoDB Service: -Do this... + .. code-block:: powershell -.. code-block:: sh + C:\mongodb\bin\mongod.exe --remove -TODO simple service example. From fc411c02738b91320c5c986684d1746db7dcb719 Mon Sep 17 00:00:00 2001 From: Andrew Leung Date: Tue, 12 Jun 2012 17:17:44 -0400 Subject: [PATCH 3/3] DOCS-155 linking Windows Installation Tutorial --- source/installation.txt | 3 +-- source/tutorial.txt | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/installation.txt b/source/installation.txt index f87be61f943..2979bd40dd0 100644 --- a/source/installation.txt +++ b/source/installation.txt @@ -18,8 +18,7 @@ and packages. Choose your platform below: tutorial/install-mongodb-on-debian-or-ubuntu-linux tutorial/install-mongodb-on-linux tutorial/install-mongodb-on-os-x - -- :wiki:`Windows ` + tutorial/install-mongodb-on-windows Release Notes ------------- diff --git a/source/tutorial.txt b/source/tutorial.txt index befa554687b..85712c93e98 100644 --- a/source/tutorial.txt +++ b/source/tutorial.txt @@ -58,6 +58,7 @@ Installation tutorial/install-mongodb-on-linux tutorial/install-mongodb-on-os-x tutorial/install-mongodb-on-redhat-centos-or-fedora-linux + tutorial/install-mongodb-on-windows .. index:: tutorials; application development .. index:: application tutorials