the problem still happens, when dbpath is a path with spaces (i.e. c:
\Program Files\something\db\)
even if you put the path quoted, when it is installed, the quotes are
removed and is necessary to change the path in the registry key.
I'm going to make a script to solve it as a quickfix for myself and I
will check the source code to see if I get to solve it and send a
patch.
best regards,
On Dec 11 2009, 2:47 am, devfuel <e...@devfuel.com> wrote:
> I can shed some light here (albeit just a bit). After running into
> this myself, I found this thread. I reinstalled the new version of
> mongodb and, on a hunch, used the full path of the executable:
>
> c:\> c:\dir1\dir2\mongodb\bin\mongod.exe --install
>
> I then checked the registry for theservice, and, indeed the full path
> was there and i could start/stop theservicefrom the control panel
> without issue.
>
> I am guessing that people who have this issue have (as I did the first
> time) used the shortcut name for the executable:
>
> c:\dir1\dir2\mongodb\bin\> mongod --install
>
> The command line seems to be inserted as typed into the registry
> without taking into account the current working directory.
>
> -ee
>
> On Dec 8, 12:04 am, Richard <richardverz...@gmail.com> wrote:
>
>
>
> > I have been looking in the registry and I know what's wrong.
> > The key HKLM/SYSTEM/CurrentControlSet/Services/MongoDB/ImagePath has
> > the value 'mongod --service'. After I have changed it to 'c:\mongo\bin
> > \mongod --service' it worked.
> > Now it is possible to start and stop theservicewith the Windows
> > services menu (services.msc).
>
> > It seems that ServiceController::installService and
> > ServiceController::startService are not OK.
> > ServiceController::removeService works fine.
>
> > On Dec 7, 11:22 pm, Eliot Horowitz <eliothorow...@gmail.com> wrote:
>
> > > None of us really windows experts.
> > > Can you start the db successfully not as aservice?
> > > That would at least give us some direction.
>
> > > On Mon, Dec 7, 2009 at 10:14 AM, Richard <richardverz...@gmail.com> wrote:
> > > > When I try to start mongod as aserviceI see:
>
> > > > c:\mongo\bin>mongod --service
> > > > Mon Dec 07 16:10:41 dbexit:
> > > > Mon Dec 07 16:10:41 shutdown: going to flush oplog...
> > > > Mon Dec 07 16:10:41 shutdown: going to close sockets...
> > > > Mon Dec 07 16:10:41 shutdown: waiting for fs...
> > > > Mon Dec 07 16:10:42 shutdown: closing all files...
> > > > Mon Dec 07 16:10:42 closeAllFiles() finished
> > > > Mon Dec 07 16:10:42 dbexit: really exiting now
>
> > > > The Event Viewer (System) shows the message:
> > > > The Mongo DBservicefailed to start due to the following error:
actually, I solved the problem running mongod.exe with
--dbpath="\"c:\Program Files\etc...\db\"" --install
2010/1/21 Marinho Brandão <mar...@gmail.com>:
--
Marinho Brandão (José Mário)
http://marinhobrandao.com/
The code here just takes what is sent to the install command, replaces
"--install" with "--service", and registers the application.
If the path to mongodb.exe (lets call it PATH_TO_MONGO) is relative (".
\mongodb.exe") instead of fully qualified ("c:\program files\mongo\bin
\mongodb.exe"), then when launched in the context of the service
sandbox, the path cannot be found because it would be relative to the
server environment, rather than where the user called the --install
operation from.
On fully qualified vs relative paths:
http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#fully_qualified_vs._relative_paths
In other words, if you couldn't run PATH_TO_MONGO from _any_ command
window in any directory, then you would encounter this error. If you
had "c:\program files\mongo\bin\" in your PATH environment variable
and PATH_TO_MONGO was "mongodb.exe", then it would work.
The code solution would be to take the executable path (argv[0])
detect if it was relative, and resolve its absolute path before
sending it to CreateService.
I believe it would be appropriate to use GetFullPathName():
http://msdn.microsoft.com/en-us/library/aa364963(VS.85).aspx
You would have to figure out how you would detect your absolute path
(occurrence of drive letter in path "C:\" etc.) in terms of desired
operation.
Cheers,
ee
This can be done via the
On Jan 21, 11:47 am, Dwight Merriman <dwi...@10gen.com> wrote:
> i'm no expert on windows services -- if someone knows them well and wants to
> tell me the change needed in the util/ntservice.cpp mongodb source file, I
> can make it.
>
>
>
> On Thu, Jan 21, 2010 at 12:26 PM, Marinho Brandao <mari...@gmail.com> wrote:
> > Hi folks
>
> > actually, I solved the problem running mongod.exe with
> > --dbpath="\"c:\Program Files\etc...\db\"" --install
>
> > 2010/1/21 Marinho Brandão <mari...@gmail.com>:
> > mongodb-user...@googlegroups.com<mongodb-user%2Bunsubscribe@google groups.com>
> > .
> > >> > > > For more options, visit this group athttp://
> > groups.google.com/group/mongodb-user?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "mongodb-user" group.
> > > To post to this group, send email to mongod...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > mongodb-user...@googlegroups.com<mongodb-user%2Bunsubscribe@google groups.com>
> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/mongodb-user?hl=en.
>
> > --
> > Marinho Brandão (José Mário)
> >http://marinhobrandao.com/
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "mongodb-user" group.
> > To post to this group, send email to mongod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > mongodb-user...@googlegroups.com<mongodb-user%2Bunsubscribe@google groups.com>
one can type
C:\mongodb-win32-x86_64-1.2.4\bin\mongod.exe --install
OR
C:\mongodb-win32-x86_64-1.2.4\bin\mongod.exe -install
and the installation works, however the installer must be replacing
only --install with --service
so if you run the latter command, the registry key mentioned above
ends up being
C:\mongodb-win32-x86_64-1.2.4\bin\mongod.exe -install
when it should be
C:\mongodb-win32-x86_64-1.2.4\bin\mongod.exe --service
so the code should look for -install as well
once I edited the registry key and changed to the line above it worked
Your solution is spot on. I made the change in registry key from
'mongodb.exe --install' to mongodb.exe --service' and it worked.
Thanks!
tk