Running ArangoDB as Windows Service

406 views
Skip to first unread message

skoeh...@gmail.com

unread,
Nov 21, 2013, 10:29:57 AM11/21/13
to aran...@googlegroups.com
I would like to run ArangoDB as a Windows Service. I tried using the --daemon option, but it does not have an effect on Windows systems. So, I have put together a script using the service wrapper from Apache. (http://commons.apache.org/proper/commons-daemon/procrun.html) I can successfully get ArangoDB to start as a service, but stopping the service is an issue. 

Is there an API call that I can make to the ArangoDB server to shutdown? I looked in the documentation, but I could not locate a shutdown command. The app tskill.exe in Windows does a terminate process, not a signal like SIGINT, so that wont work for me.

Any ideas on how to gracefully shutdown the ArangoDB process?


Frank Celler

unread,
Nov 21, 2013, 10:36:39 AM11/21/13
to aran...@googlegroups.com
Cool.

I'm not really a Windows programmer: Jan & I have to investigate how "tskill" works.

Cheers
  Frank

Jan Steemann

unread,
Nov 21, 2013, 10:51:22 AM11/21/13
to aran...@googlegroups.com
There currently is no API that one can call that will shutdown arangod.
On Linux, you can send the arangod process a SIGINT, and it start
shutting down.

On Windows, we're using the SetConsoleCtrlHandler command to bind CTRL-C
to a termination handler. This works when arangod is started via an
MS-DOS command prompt.
I guess that when started as a daemon, there is no command prompt and
thus no console available, so the control-handler will not work.

Looks like there is also a signal() function for Windows, but we didn't
try this yet:
http://msdn.microsoft.com/en-us/library/xdkz3x12%28v=vs.90%29.aspx

Maybe this is the way to go. At least I think that taskkill.exe uses
TerminateProcess, and I think this cannot be trapped.

Best regards
Jan

On 21.11.2013 16:36, Frank Celler wrote:
> Cool.
>
> I'm not really a Windows programmer: Jan & I have to investigate how
> "tskill" works.
>
> Cheers
> Frank
>
>
> Am Donnerstag, 21. November 2013 16:29:57 UTC+1 schrieb skoeh...@gmail.com:
>
> I would like to run ArangoDB as a Windows Service. I tried using the
> --daemon option, but it does not have an effect on Windows systems.
> So, I have put together a script using the service wrapper from
> Apache.
> (http://commons.apache.org/proper/commons-daemon/procrun.html
> <http://commons.apache.org/proper/commons-daemon/procrun.html>) I
> can successfully get ArangoDB to start as a service, but stopping
> the service is an issue.
>
> Is there an API call that I can make to the ArangoDB server to
> shutdown? I looked in the documentation, but I could not locate a
> shutdown command. The app tskill.exe in Windows does a terminate
> process, not a signal like SIGINT, so that wont work for me.
>
> Any ideas on how to gracefully shutdown the ArangoDB process?
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "ArangoDB" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to arangodb+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Jan Steemann

unread,
Nov 21, 2013, 11:04:20 AM11/21/13
to aran...@googlegroups.com
I just tried tskill, and it seems it cannot be trapped.
So tskill is probably not the way to do it.

Best regards
Jan

Steven Koehler

unread,
Nov 21, 2013, 6:00:38 PM11/21/13
to aran...@googlegroups.com, j.ste...@triagens.de
I'm thinking maybe adding service wrapper code into the actual ArangoDB might be the best way. It would be the cleanest way, rather than an outside wrapper.

-Steven

Jan Steemann

unread,
Nov 21, 2013, 6:14:02 PM11/21/13
to Steven Koehler, aran...@googlegroups.com
It looks like this article here describes a way to do this:
http://code.msdn.microsoft.com/windowsdesktop/CppWindowsService-cacf4948

I need to try this once I have some time left.

Thanks for the suggestion and best regards
Jan
> <http://www.google.com/url?q=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fxdkz3x12%2528v%3Dvs.90%2529.aspx&sa=D&sntz=1&usg=AFQjCNHtCHAiYn2ufQtqjEYALC6cQRfYqg>
>
> >
> > Maybe this is the way to go. At least I think that taskkill.exe uses
> > TerminateProcess, and I think this cannot be trapped.
> >
> > Best regards
> > Jan
> >
> > On 21.11.2013 16:36, Frank Celler wrote:
> >> Cool.
> >>
> >> I'm not really a Windows programmer: Jan & I have to investigate
> how
> >> "tskill" works.
> >>
> >> Cheers
> >> Frank
> >>
> >>
> >> Am Donnerstag, 21. November 2013 16:29:57 UTC+1 schrieb
> >> skoeh...@gmail.com:
> >>
> >> I would like to run ArangoDB as a Windows Service. I tried
> using the
> >> --daemon option, but it does not have an effect on Windows
> systems.
> >> So, I have put together a script using the service wrapper from
> >> Apache.
> >>
> (http://commons.apache.org/proper/commons-daemon/procrun.html
> <http://www.google.com/url?q=http%3A%2F%2Fcommons.apache.org%2Fproper%2Fcommons-daemon%2Fprocrun.html&sa=D&sntz=1&usg=AFQjCNG4j3MHH8_hoSpw_e6NaeoMyN-dcA>
>
> >>
> <http://commons.apache.org/proper/commons-daemon/procrun.html
> <http://www.google.com/url?q=http%3A%2F%2Fcommons.apache.org%2Fproper%2Fcommons-daemon%2Fprocrun.html&sa=D&sntz=1&usg=AFQjCNG4j3MHH8_hoSpw_e6NaeoMyN-dcA>>)
> I
> >> can successfully get ArangoDB to start as a service, but
> stopping
> >> the service is an issue.
> >>
> >> Is there an API call that I can make to the ArangoDB server to
> >> shutdown? I looked in the documentation, but I could not
> locate a
> >> shutdown command. The app tskill.exe in Windows does a
> terminate
> >> process, not a signal like SIGINT, so that wont work for me.
> >>
> >> Any ideas on how to gracefully shutdown the ArangoDB process?
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "ArangoDB" group.
> >> To unsubscribe from this group and stop receiving emails from
> it, send
> >> an email to arangodb+u...@googlegroups.com <javascript:>.
> >> For more options, visit https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>.
> >
>

Jesse Shaffer

unread,
Dec 5, 2013, 10:40:06 AM12/5/13
to aran...@googlegroups.com
I have been able to install ArangoDB as a Windows service using http://nssm.cc/

It executes the ArangoDB.bat file, and at shutdown passes the CTRL-C command to kill it.

Frank Celler

unread,
Dec 5, 2013, 11:05:20 AM12/5/13
to aran...@googlegroups.com
That perfect news. I'll add this to the manual.

Frank Celler

unread,
Dec 26, 2013, 12:28:01 PM12/26/13
to aran...@googlegroups.com
We moved to Visual Studio 2013 and CMAKE for Windows for ArangoDB 1.4.4.

It now comes with the possibility to run as service without any outside program. Please let us know if this works for you.

See https://www.arangodb.org/2013/12/26/arangodb-xmas-edition-1-4-4 for details.

Merry Chrismas
  Frank

Steven Koehler

unread,
Dec 30, 2013, 10:55:20 PM12/30/13
to aran...@googlegroups.com
Great News! I will give this new version with service support a try.

Merry Christmas,
Steven
Reply all
Reply to author
Forward
0 new messages