问题
I have previously installed CouchDB on my Azure Windows VM (Classic) without any problems using the installer setup-couchdb-1.6.1_R16B02.exe downloaded from http://couchdb.apache.org/
Today I have uninstalled the existing CouchDB installation and service with the intention of installing it again from scratch. Unfortunately, whenever I run the installer now it fails to create a windows service. More info:
- I am running the installer and the command tool as Administrator
- I have removed existing services using the SC command and by editing the registry (tried both methods)
- I have tried creating the service after installing CouchDB using the installer by running the command:
erlsrv.exe add "Apache CouchDB" -workdir "%COUCH%\bin" -onfail restart_always -args "-sasl errlog_type error -s couch +A 4 +W w" -comment "Apache CouchDB 1.6.1"
This seems to create a service (which you can see in the Windows Services) but any attempt to start the service results in an error:
Windows could not start the Apache CouchDB service on Local Computer.
Error 1067: The process terminated unexpectedly.
- I have tried uninstalling the CouchDB application, restarting the server, re-installing CouchDB using the installer again. No joy. Also then tried running the command to create the service. Still no joy.
- When I use the command
erlsrv list
I can see the services that I've tried to add in the past. Any attempt to remove them results in the error message:
erosrv: Unable to remove service (not enough privileges?)
Error: The handle is invalid
(I am using the handle as provided by the erlsrv list command)
- there are no events in the events log that I can find that explain why this is failing
How can I get CouchDB to install as a service correctly?
回答1:
TL;DR: Re-install in a directory path with no spaces in it, then manually create the service.
OK so at some point in my Googling today I came across this answer which gave me the clue that I should install in a path without spaces in it. So my solution was to:
- uninstall the CouchDB application via Windows Control Panel.
- run the uninstall.exe in any remaining installations of CouchDB and delete those directories.
- remove the existing services using the SC command.
- reinstall using the installer into C:\CouchDB (note: no spaces!). Select the option to install as a service (even though this doesn't quite work).
- run the command to manually create the service. Note that I'm not using the %COUCH% variable as it doesn't seem to exist on my system at this point:
erlsrv.exe add "CouchDB" -workdir "C:\CouchDB\bin" -onfail restart_always -args "-sasl errlog_type error -s couch +A 4 +W w" -comment "CouchDB 1.6.1"
This command finally managed to properly create a windows service for CouchDB that started correctly. Browsing to http://localhost:5984/_utils/ now brings me to the Futon UI. And relax!
来源:https://stackoverflow.com/questions/39372800/couchdb-will-not-install-as-a-service-on-azure-windows-vm