Search code examples
windowspowershellconsulspring-cloud-consul

Start Consul as windows service


I'm trying to run consul on windows, my steps:

  1. Download consul.exe
  2. Install nssm like

    2.1.iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

    2.2.choco install -y nssm

  3. Create config file for consul:

    { "bootstrap": false, "server": true, "datacenter": "MyServices", "data_dir": "C:\Marchello\Downloads\cons\data", "log_level": "INFO" }

  4. Execute nssm command:

    nssm install Consul C:\Marchello\Downloads\cons\consul.exe agent -config-dir C:\Marchello\Downloads\cons\config --ui-dir C:\Marchello\Downloads\cons\ui

  5. Got message Service Consul installed successfully

  6. Run command nssm start Consul In result I'm getting message: Consul: Unexpected status SERVICE_PAUSED in response to START control

I'm confused, what I'm doing wrong?


Solution

  • How many of the services are starting actually? It happens when starting more than ~16 services. The first 16 will start successfully, and then the rest stays as in "Paused" state.

    On the other hand, it might be a privilege issue. Changing the logon to Administrator should fix the issue.

    Also, check Application event log for errors where the source is nssm around the time you have installed the service.

    Hope the steps help you.