Navigation Menu

Skip to content
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

When starting Consul as a windows service, it terminates immediately #6661

Closed
xBentu opened this issue Oct 21, 2019 · 9 comments
Closed

When starting Consul as a windows service, it terminates immediately #6661

xBentu opened this issue Oct 21, 2019 · 9 comments

Comments

@xBentu
Copy link

xBentu commented Oct 21, 2019

I posted on an older issue hoping that I wouldn't have to make a new one, but didn't get an answer so I am making a new issue and linking to my comment. Any help is appreciated, and let me know if you need additional information.

#5623 (comment)

@spawluk
Copy link

spawluk commented Oct 23, 2019

Your command is incorrect. You should place "=" after "-config-dir" flag

@xBentu
Copy link
Author

xBentu commented Oct 23, 2019

@spawluk That doesn't seem to resolve the issue.

I used:

sc.exe create "Consul" binPath= "C:\Users\tguichin\ConsulSetup\Consul\consul.exe agent -config-dir=C:\Users\tguichin\ConsulSetup\Consul\consul.d\consul_config.json" start= auto

and this is what I get when running in console.

image

@spawluk
Copy link

spawluk commented Oct 23, 2019

It looks like confuration error. Did you tried to run this command manually - not using windows service sc.exe?

@xBentu
Copy link
Author

xBentu commented Oct 23, 2019

@spawluk Okay. So I tried it manually and it requires a bind due to multiple IP addresses. It also requires -data-dir parameter.

As for "no known consul servers" error, does the -server parameter have to be given in order to be able to run consul?

@xBentu
Copy link
Author

xBentu commented Oct 23, 2019

@spawluk I just looked back at the docs for "Running consul as a windows service" from the consul website and it seems the documentation is wrong.

https://learn.hashicorp.com/consul/datacenter-deploy/windows

This is what they use as console command to make a service, but it doesn't work.

sc.exe create "Consul" binPath= "path to the Consul.exe agent-config-dir path to configuration directory" start= auto

No '=' after '-config-dir' and no space in between 'agent' and '-config-dir' although I don't know if that would even be an issue.

@spawluk
Copy link

spawluk commented Oct 23, 2019

Personally I use consul with https://github.com/kohsuke/winsw wrapper. Command I use is consul.exe agent -config-dir=./configs.

Consul is run in one of 2 modes: client or server. To be able to run consul you have to have at least one server role consul. As documentation say server consul role is able to act as client, so you can use it as 127.0.0.1 DNS server on Eth interface. But to do that you have to change DNS port from defualt 8600 to 53. Then it requires Admin rights to run application due to MS ports below 1024 security policy.

@xBentu
Copy link
Author

xBentu commented Oct 23, 2019

@spawluk thank you for your help. I'll have to do some more reading to better learn what each parameter is used for.

Hopefully someone can update the docs on consul.io because, as they are right now, you can't run consul as a service.

@blake
Copy link
Member

blake commented Oct 23, 2019

@xBentu Thanks for bringing this to our attention. I'll correct the docs to reflect the proper command syntax.

@xBentu
Copy link
Author

xBentu commented Oct 24, 2019

@blake no problem. Thank you for the quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants