Windows Service
Memurai can be installed as a Windows service during the initial setup, or later using the command line options. Multiple instances of Memurai can run simultaneously as Windows service instances.
Depending on the settings specified in the configuration file, each instance of a Memurai Windows service can take any one of the master
, replica
, cluster node
or sentinel
roles.
All the Memurai Windows service commands require administrator privileges.
Installation with the MSI setup
The MSI setup has an option to install Memurai as a Windows service. When installed as a service during setup, the Memurai service is configured to use
the default configuration file memurai.conf
provided in the Memurai installation directory (typically in C:\Program Files\Memurai
).
If the user doesn't choose to install Memurai as a Windows service during setup, it's still possible to do it later from the command line.
Service Install
Syntax:
memurai.exe --service-install [--service-name service_name] [--sentinel] config_file
If --service-name
is not specified, the default service name is Memurai
.
Note: specifying a configuration file is required.
The service initial working directory will be the directory of the configuration file,
and any relative paths specified in the configuration file will be relative to that working directory (unless the config file changes
the working directory by specifying a dir
flag).
The --service-install
command installs the service without starting it. To learn how to start the service, see Service Start.
To install the Memurai Windows service using the default service name Memurai
and specifying the configuration file memurai.conf
:
memurai.exe --service-install memurai.conf
To install the Memurai Windows service using the service name memurai-1
and specifying the configuration file memurai-1.conf
:
memurai.exe --service-install --service-name "memurai-1" memurai-1.conf
To install the Memurai Windows service in sentinel mode, using the service name memurai-sentinel
and specifying the configuration file memurai-sentinel.conf
:
memurai.exe --service-install --service-name "memurai-sentinel" --sentinel memurai-sentinel.conf
Service Uninstall
Syntax:
memurai.exe --service-uninstall [--service-name service_name]
To uninstall the Memurai Windows service that was installed using the default service name Memurai
:
memurai.exe --service-uninstall
To uninstall the Memurai Windows service that was installed using the service name memurai-1
:
memurai.exe --service-uninstall --service-name "memurai-1"
Service Start
To start the Memurai Windows service that was installed using the default service name memurai
:
memurai.exe --service-start
or:
net start memurai
To start the Memurai Windows service that was installed using the service name memurai-1
:
memurai.exe --service-start --service-name "memurai-1"
or:
net start memurai-1
The --service-start
command will work even from a non-elevated command prompt, assuming the user has administrative privileges. In the same scenario, net start
will fail with Access denied
error.
Service Stop
To stop the Memurai Windows service that was installed using the default service name memurai
:
memurai.exe --service-stop
or:
net stop memurai
To stop the Memurai Windows service that was installed using the service name memurai-1
:
memurai.exe --service-stop --service-name "memurai-1"
or:
net stop memurai-1
The --service-stop
command will work even from a non-elevated command prompt, assuming the user has administrative privileges. In the same scenario, net stop
will fail with Access denied
error.
Note: the Memurai Windows service doesn't support the net pause
and net continue
commands.
Making changes to the service configuration
Changes to the configuration file used by a service installation are only picked up the next time the service starts. So, if you want to change the configuration of a running service by editing the configuration file, you will have to restart the service manually.
Alternatively, you can use the CONFIG SET
command, which allows changing the configuration while Memurai is running.