-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot run etcd as a Windows service #10433
Comments
@hexfusion I'll look into it but it may take a few days becasue I have little to no experience with Go. |
@jasper-d we can assist with the go if you can assist with windows testing. Take a look at the old existing PR above and see if it gives you any hints. Basically can you review the existing research that was done and see what is the proper method for managing a Windows service with golang? Maybe it is is the same in which case we can reuse that PR as a starting point. 1.) review existing PRs and issues. From here we have a good place to start, this will move it forward without code. Thanks! |
@hexfusion I dont mind trying out some things and learning some go in the process. I got the PR working with some minor changes and will take a look at some go services that run on windows (i.e. gnatsd, Elastic Filebeat) to see how they do it. |
Hi @jasper-d just checking in do you have any questions? |
@hexfusion Not yet, I was occupied with some more pressing issues. I probably wont have time to look into it before next weekend. |
Just wanted to let you know that this is not a general issue. Of note:
I am using the pre-release version 2.2.4-101 linked on this page: https://nssm.cc/download With I am not doing anything too special parameter-wise. I am specifying various bindings explicitly, though. And also I am not binding anything to Example:
|
@tskarman @hexfusion |
@haroldHT #3410 Does not gracefully stop etcd and has some other flaws. The reason that etcd does not work as a service is that it doesn't communicate with SCM. #3410 adds some basic support for it (using golang's svc package which essentially all windows services written in go use). Properly handling stop/shutdown as well as redirecting stdout/stderr (i.e enabling log output) requires some more work. You're welcome to contribute of course. 🙂 @tskarman NSSM does a lot of stuff (i.e. stdout/stderr redirection). I reckon it does communicate with SCM as well which would explain why you can start etcd as a service when using it. However, relying on hackish 3rd party tools is a workaround, not a solution from my point of view. |
@jasper-d yes, I completely understand and now am interested in a solution as well. let me know when I can help you. My That being said. I run etcd like this in production and have not encountered any reliability or responsivity or service signalling issue. So I would recommend this as a workaround for the time being. |
@haroldHT thanks for showing interest in resolving this. Please work with @jasper-d and @tskarman on a solution then let me know if you have any questions. |
@hexfusion Sorry,I always @ wrong people, |
cc @wenjiaswe |
/assign @haroldHT |
well, it seems like I cannot assign you @haroldHT now, this is a good place to start your contribution. Thanks! |
@haroldHT I managed to botch up the code base enough to make etcd run as a windows service. It properly interacts with Windows Service Control Manager through cc: @hexfusion @tskarman |
+1
--
—
|
Changes (with some comments) are here: jasper-d@9d92352 The good:
The bad:
So, there is still a lot of work to do. Before continuing I would need to add at least some tests and set up a proper testing environment. The main problems remain the wealth of logs (I would certainly need some advice here) and the different ways in which etcd is started. I think that should be unified ideally, but that would probably be quite a refactoring (i.e. should be done by someone with a better understanding of the code base and go). @haroldHT How is it going for you? |
@wenjiaswe sorry, I did not reply in time. |
@jasper-d At the beginning I want to use |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions. |
Repro:
sc create etcd binpath= "C:\etcd\etcd.exe --data-dir C:\etcd\data" obj= "NT AUTHORITY\Local Service
net start etcd
Expected:
ectd service starts
Actual:
etcd service start times out
Windows event log shows two errors:
C:\etcd\data contains the following files:
FullName, Length
C:\etcd\data\member, 1
C:\etcd\data\member\snap, 1
C:\etcd\data\member\wal, 1
C:\etcd\data\member\snap\db, 32768
C:\etcd\data\member\snap\db.lock, 0
C:\etcd\data\member\wal\0.tmp, 64000000
C:\etcd\data\member\wal\0000000000000000-0000000000000000.wal, 64000000
Workaround:
Additional information:
Running etcd.exe from the command prompt works fine. However, etcd service won't even run as "LocalSystem" (that's the "Do whatever you want" built-in account).
I was able to reproduce the issue on multiple Win10 machines.
I assume that it has something to do with the working directory (that's at least the most likely cause from my experience if an application can be started from cmd.exe but not as a service). The default working directory for a Windows service is C:\Windows\system32 (which is locked down for good reasons).
Environment:
etcd Version: 3.3.11
Git SHA: 2cf9e51
Go Version: go1.10.7
Go OS/Arch: windows/amd64
The text was updated successfully, but these errors were encountered: