From b41c8cda69818f5668d8f0fcdb7bc94ee0397a73 Mon Sep 17 00:00:00 2001 From: Andrew Aldridge Date: Thu, 18 Jun 2015 13:08:05 -0400 Subject: [PATCH] DOCS-5501: Bring back Windows service configuration instructions --- ...configure-windows-service-for-mongodb.yaml | 72 +++++++++++++++++++ ...indows-service-for-mongodb-enterprise.yaml | 56 --------------- .../install-mongodb-enterprise-on-windows.txt | 7 +- .../tutorial/install-mongodb-on-windows.txt | 5 ++ 4 files changed, 83 insertions(+), 57 deletions(-) create mode 100644 source/includes/steps-configure-windows-service-for-mongodb.yaml delete mode 100644 source/includes/steps-create-manually-windows-service-for-mongodb-enterprise.yaml diff --git a/source/includes/steps-configure-windows-service-for-mongodb.yaml b/source/includes/steps-configure-windows-service-for-mongodb.yaml new file mode 100644 index 00000000000..6c118e3883a --- /dev/null +++ b/source/includes/steps-configure-windows-service-for-mongodb.yaml @@ -0,0 +1,72 @@ +stepnum: 1 +inherit: + file: steps-create-manually-windows-service-for-mongodb.yaml + ref: open-command-prompt +--- +title: Configure directories and files. +stepnum: 2 +ref: directories +pre: | + Create a :doc:`configuration file ` + and a directory path for MongoDB log output (:setting:`logpath`): +action: + - pre: | + Create a specific directory for MongoDB log files: + language: powershell + code: | + md "C:\mongodb\log" + - pre: | + In the :guilabel:`Command Prompt`, create a configuration file for + the :setting:`logpath` option for MongoDB: + language: powershell + code: | + echo logpath=C:\mongodb\log\mongo.log > "C:\mongodb\mongod.cfg" +--- +title: Run the MongoDB service. +stepnum: 3 +ref: mongodb-service +pre: | + .. important:: + + Run all of the following commands in :guilabel:`Command Prompt` with + "Administrative Privileges:" +action: + - pre: | + Install the MongoDB service. For :option:`--install ` to succeed, you *must* specify the :setting:`logpath` + run-time option. + language: powershell + code: | + "C:\mongodb\bin\mongod.exe" --config "C:\mongodb\mongod.cfg" --install + - pre: | + Modify the path to the ``mongod.cfg`` file as needed. +post: | + To use an alternate :setting:`dbpath`, specify the path in the + configuration file (e.g. ``C:\mongodb\mongod.cfg``) or + on the command line with the :option:`--dbpath ` option. + + If the :setting:`dbpath` directory does not exist, :program:`mongod.exe` + will not start. The default value for :setting:`dbpath` is ``\data\db``. + + If needed, you can install services for multiple instances of + :program:`mongod.exe` or :program:`mongos.exe`. Install each service + with a unique :option:`--serviceName ` and + :option:`--serviceDisplayName `. Use + multiple instances only when sufficient system resources exist and your + system design requires it. +--- +title: Stop or remove the MongoDB service as needed. +stepnum: 4 +ref: stop +action: + - pre: | + To stop the MongoDB service use the following command: + language: powershell + code: | + net stop MongoDB + - pre: | + To remove the MongoDB service use the following command: + language: powershell + code: | + "C:\mongodb\bin\mongod.exe" --remove +... diff --git a/source/includes/steps-create-manually-windows-service-for-mongodb-enterprise.yaml b/source/includes/steps-create-manually-windows-service-for-mongodb-enterprise.yaml deleted file mode 100644 index 2aae14a0e16..00000000000 --- a/source/includes/steps-create-manually-windows-service-for-mongodb-enterprise.yaml +++ /dev/null @@ -1,56 +0,0 @@ -title: - text: Open an Administrator command prompt. - character: "~" -stepnum: 1 -ref: directories -content: | - Press ``Win + R``, then type ``cmd``, then press ``Ctrl + Shift + Enter``. -post: | - Execute the remaining steps from the Administrator command prompt. ---- -stepnum: 2 -inherit: - file: steps-create-manually-windows-service-for-mongodb.yaml - ref: create-directories ---- -stepnum: 3 -inherit: - file: steps-create-manually-windows-service-for-mongodb.yaml - ref: create-configuration-file -action: - pre: | - The following creates a configuration file, specifying both the - :setting:`logpath` and the :setting:`dbpath` settings in the - configuration file: - language: powershell - code: | - echo logpath=c:\data\log\mongod.log> "C:\mongodb\mongod.cfg" - echo dbpath=c:\data\db>> "C:\mongodb\mongod.cfg" ---- -stepnum: 4 -inherit: - file: steps-create-manually-windows-service-for-mongodb.yaml - ref: create-mongodb-service -action: - - pre: "Create the MongoDB service." - language: powershell - code: | - sc.exe create MongoDB binPath= "\"C:\mongodb\bin\mongod.exe\" --service --config=\"C:\mongodb\mongod.cfg\"" DisplayName= "MongoDB" start= "auto" - post: | - ``sc.exe`` requires a space between "=" and the configuration values - (eg "binPath= "), and a "\" to escape double quotes. - - pre: "If successfully created, the following log message will display:" - language: powershell - code: | - [SC] CreateService SUCCESS ---- -stepnum: 5 -inherit: - file: steps-create-manually-windows-service-for-mongodb.yaml - ref: start-mongodb-service ---- -stepnum: 6 -inherit: - file: steps-create-manually-windows-service-for-mongodb.yaml - ref: stop-mongodb-service -... diff --git a/source/tutorial/install-mongodb-enterprise-on-windows.txt b/source/tutorial/install-mongodb-enterprise-on-windows.txt index bfed4f12ad4..5e24b65356e 100644 --- a/source/tutorial/install-mongodb-enterprise-on-windows.txt +++ b/source/tutorial/install-mongodb-enterprise-on-windows.txt @@ -55,6 +55,11 @@ Run MongoDB Enterprise .. include:: /includes/steps/run-mongodb-on-windows.rst +Configure a Windows Service for MongoDB Enterprise +-------------------------------------------------- + +.. include:: /includes/steps/configure-windows-service-for-mongodb.rst + .. _manually-create-windows-service-enterprise: Manually Create a Windows Service for MongoDB Enterprise @@ -69,4 +74,4 @@ The following procedure assumes you have installed MongoDB using the If you have installed in an alternative directory, you will need to adjust the paths as appropriate. -.. include:: /includes/steps/create-manually-windows-service-for-mongodb-enterprise.rst +.. include:: /includes/steps/create-manually-windows-service-for-mongodb.rst diff --git a/source/tutorial/install-mongodb-on-windows.txt b/source/tutorial/install-mongodb-on-windows.txt index cfb594fc3c6..dc3d46abbee 100644 --- a/source/tutorial/install-mongodb-on-windows.txt +++ b/source/tutorial/install-mongodb-on-windows.txt @@ -62,6 +62,11 @@ Run MongoDB .. _manually-create-windows-service: +Configure a Windows Service for MongoDB +--------------------------------------- + +.. include:: /includes/steps/configure-windows-service-for-mongodb.rst + Manually Create a Windows Service for MongoDB ---------------------------------------------