Running rqlited as a service in Windows

21 views
Skip to first unread message

Andy Robinson

unread,
May 22, 2023, 11:43:59 AM5/22/23
to rqlite
As is usually the case with any database I want to run rqlite as a service.  I am using my trusty tool for this, NSSM.   It starts up just fine but when I go to stop it just hangs in stopping.  I end up having to kill the PID to get it to truly shutdown.

Does anyone have experience running rqlite as a service in windows?  Below are my settings with NSSM.  Even if you don't know the product you can probably take some good guesses at what each does.  I've experimented with a few different combinations of arguments. I've also played around with the logging settings to see if by chance that might be hanging it up.   

Here are the log messages I get
[rqlited] 2023/05/22 11:42:56 received signal "interrupt", shutting down
[http] 2023/05/22 11:42:56 HTTP service stopped: http: Server closed
[rqlited] 2023/05/22 11:42:56 stepping down as Leader before shutdown
[rqlited] 2023/05/22 11:42:56 rqlite server stopped

And the NSSM settings
install rqlited rqlited.exe
set rqlited AppParameters "-node-id 1 -on-disk -on-disk-path C:\build\data\rqlite\mon.db -fk -raft-remove-shutdown node1"
set rqlited AppDirectory C:\Windows
set rqlited AppExit Default Restart
set rqlited AppNoConsole 1
set rqlited AppStdout C:\build\logs\rqlited.log
set rqlited AppStdoutCreationDisposition 2
set rqlited AppStderr C:\build\logs\rqlited.log
set rqlited AppStderrCreationDisposition 2
set rqlited AppKillProcessTree 0
set rqlited AppRotateFiles 1
set rqlited AppRotateOnline 1
set rqlited AppRotateBytes 10000
set rqlited DisplayName rqlited
set rqlited ObjectName LocalSystem
set rqlited Start SERVICE_AUTO_START
set rqlited Type SERVICE_WIN32_OWN_PROCESS

Andy Robinson

unread,
May 22, 2023, 11:48:08 AM5/22/23
to rqlite
One clarification.  Just trying to run single node on a windows box for now.  Not worried about clustering yet.

Philip O'Toole

unread,
May 22, 2023, 11:58:21 AM5/22/23
to rql...@googlegroups.com
I know relatively little about Windows, but the process gets to the very end of the code judging by your logs. The log line you see is the very last thing rqlited does:


Some of that shutdown closes network resources, perhaps something is still open and causing the OS to prevent it exiting. Are you running a single node?

--
You received this message because you are subscribed to the Google Groups "rqlite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rqlite+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rqlite/f5d79688-fc69-418f-9628-9d4653d062a5n%40googlegroups.com.

Andy Robinson

unread,
May 22, 2023, 12:12:22 PM5/22/23
to rqlite
Thanks Philip.  And you aren't kidding, that is literally the last line in the main so I agree it must be something on the OS or NSSM side not quite recognizing it's done.   Are there any preferences for how you sent the shutdown command?  I have the following options

Generate CTRL+C (with a 1500ms timeout... and I think I might have just figured it out as I typed this.... 😁... but I'll finish the post anyway)
Send WM_CLOSE to Windows (not applicable)
Post WM_QUITE to threads
Terminate Process
Kill Process Tree

They are all individual check boxes I might turn on.  Do any of them jump out as obviously yes or obviously no?

For some reason I always read the 1500 as a delay time, not a timeout.  Going to try to bump that way up and see what happens.

-andy

Andy Robinson

unread,
May 22, 2023, 12:27:45 PM5/22/23
to rqlite
Closing the loop on this.   I had my StdOut and StdErr pointed to the same file.  Apparently something in the chain didn't like that.  I repointed them to different files and all is well now.  Thanks for the confirm that everything was happy on the rqlite side, definitely helped with bisecting the issue.

-Andy

Philip O'Toole

unread,
May 22, 2023, 12:45:08 PM5/22/23
to rql...@googlegroups.com
Great, glad it's working now.

Philip

Reply all
Reply to author
Forward
0 new messages