hashicorp / consul

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
https://www.consul.io
Other
28.37k stars 4.42k forks source link

Unable to start the consul service in windows 2012 server #8241

Open jsprojects2 opened 4 years ago

jsprojects2 commented 4 years ago

Hi,

I am trying to run the consul service in windows 2012 server, I ran the following command from command prompt

sc create "Consul_Service" binPath="C:\Microservices Tool\consul\consul.exe agent -config-dir=C:\Microservices Tool\consul\consul_configA.json" start=auto

the consul.exe is installed in the window sercive.

after that i am running the following command

sc start consul_service

the consul service is unable to run, it is throwing an error

Windows could not start the Consul_Service service on Local Computer.

Error 1067: The process terminated unexpectedly.

Please kindly give us a suggestion to make it working. or do i missed something during installation or any other info.

Originally posted by @jsprojects2 in https://github.com/hashicorp/consul/issues/2745#issuecomment-653923683

idrennanvmware commented 4 years ago

@jsprojects2 - could you post your consul config file? Also any logs would be helpful too. Whenever we have seen this we have tried a few different approaches (btw, normally this is an indication we messed up our config file) but the most tried and true brute force is we try running the service start command manually (so not as a service but straight from the command line). Often this right away points us to the error.

Also, the CLI has a validate command https://www.consul.io/docs/commands/validate that you can try as well, just to make sure things are all good.

jsprojects2 commented 4 years ago

Hi,

I have ran the consul validate command, which is returning success.

Here is my configuration file consul config

naariah commented 4 years ago

I have the same question.it is worked in windows 10 but not work in windows 2012 server.

idrennanvmware commented 4 years ago

can you add

"log_file":"C:/Microservices Tool/consul/Logs/consul.log"

See what that gives you for logs?

jsprojects2 commented 4 years ago

Hi,

I am able to run the consul application if the command prompt running, But when i am trying to make it as a service , the service is not starting (it says unable to start with the error code is : 1067, please see the log file which might help you to help me out.

looking forward to hear from you soon.

consul-1594807254178453800.log

dnephin commented 4 years ago

This line in the log seems relevant. I wonder what sent the interrupt signal.

[INFO]  agent: Caught: signal=interrupt
jsprojects2 commented 4 years ago

Hi,

I am able to run the consul application if the command prompt running, But when i am trying to make it as a service , the service is not starting (it says unable to start with the error code is : 1067, please see the log file which might help you to help me out.

looking forward to hear from you soon.

consul-1594807254178453800.log

what could be the error that we are facing here?

idrennanvmware commented 4 years ago

Not sure if this helps but it looks like your args aren't been passed in correctly https://stackoverflow.com/questions/3663331/when-creating-a-service-with-sc-exe-how-to-pass-in-context-parameters indicates bin path can be fickle.

We use win nssm instead of sc and have been very happy with it on windows machines

ozmeroz commented 1 year ago

hello,Im facing same issue with creating consul(latest version) as windows service on windows server 2019. service is created succesfully with this command: sc create consul binpath= "C:\Program Files\Qognify\consul\consul.exe agent --config-dir C:\Program Files\Qognify\consul\config --server --client 0.0.0.0" start= auto

but wont start - image

tried everything, what am I missing? config file attached. Thanks in advance, Oz config.zip

journey191 commented 1 week ago

Hi,

I am able to run the consul application if the command prompt running, But when i am trying to make it as a service , the service is not starting (it says unable to start with the error code is : 1067, please see the log file which might help you to help me out.

looking forward to hear from you soon.

consul-1594807254178453800.log

Same question in windows server 2012! It works well in commond line but can not start as a windows service (errcode:1053).