Services - Windows systems
The following describes how to set up OpenSearch and Karaf as a Windows service.
OpenSearch
|
If an OpenSearch service is already installed on this machine, it may be necessary to rename the new service in the file , as a service cannot be installed twice with the same name === Install Windows service The following instruction installs the service. rename the new Service in the file
|
Install Windows Service
The following instruction installs the Service.
INSTALLATIONSVERZEICHNIS\opensearch\bin\opensearch-service.bat install bpc-opensearch
Start Windows Service
The following instruction starts the Service.
INSTALLATIONSVERZEICHNIS\opensearch\bin\opensearch-service.bat start
Configure Windows Service
Now you should set the Service to Automatisch so that it is started automatically when the server is restarted:

To customize the Service’s storage options, you must use the Manager. This is called up as follows:
INSTALLATIONSVERZEICHNIS\opensearch\bin\opensearch-service.bat manager
Karaf
The Karaf directory INSTALLATIONSVERZEICHNIS\karaf\bin\contrib contains the files karaf-service-win.exe and karaf-service-win.xml.
You can install, uninstall, start and stop the Service via the file karaf-service-win.exe.
In karaf-service-win.xml you must adjust the placeholders for the Service.
Replace the following placeholders:
-
%KARAF_SERVICE_NAME%- Name of the Service under Windows. Example: "Karaf" -
%KARAF_SERVICE_PATH%- Base path of the Karaf installation. Example: "C:\BPC\karaf" -
%KARAF_SERVICE_EXECUTABLE%- Name of the file in the directorybinwith which Karaf is started. Example: "karaf.bat"
Alternatively, you can keep the placeholders. In this case, set these environment variables for the system or operating system user that is to start the Karaf Service:
[[environment variables]]
KARAF_SERVICE_NAME=Karaf
KARAF_SERVICE_PATH=C:\BPC\karaf
KARAF_SERVICE_EXECUTABLE=karaf.bat
karaf-service-win.xml mit Platzhaltern für Umgebungsvariablen<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<service>
<!--
This script is provided as a template you can quickly customize by replacing
the following variables:
KARAF_SERVICE_NAME
KARAF_SERVICE_PATH
KARAF_SERVICE_EXECUTABLE
For a detailed overview of the configuration options, please visit winsw home
page (https://github.com/kohsuke/winsw)
-->
<!-- Required. Has to be unique among all the services installed in a system. Should consist entirely out of alpha-numeric characters. -->
<id>%KARAF_SERVICE_NAME%</id>
<!-- Optional. Has to be unique among all the services installed in a system. Short display name of the service, which can contain spaces and other characters. -->
<name>%KARAF_SERVICE_NAME%</name>
<!-- Optional. Long human-readable description of the service. -->
<description>Apache Karaf Service with ID "%KARAF_SERVICE_NAME%" for BPC</description>
<!-- start -->
<executable>%KARAF_SERVICE_PATH%\bin\contrib\%KARAF_SERVICE_EXECUTABLE%</executable>
<startargument>daemon</startargument>
<!-- stop -->
<stopexecutable>%KARAF_SERVICE_PATH%\bin\contrib\%KARAF_SERVICE_EXECUTABLE%</stopexecutable>
<stopargument>stop</stopargument>
<stoptimeout>10sec</stoptimeout>
<!-- log into the same directory as karaf. Size is in kbyte. -->
<logpath>%KARAF_SERVICE_PATH%\data\log</logpath>
<log mode="roll-by-size">
<sizeThreshold>2048</sizeThreshold>
<keepFiles>3</keepFiles>
</log>
</service>
Windows-Dienst installieren
Mit folgendem Befehl wird der Service in Windows installiert. Anschließend kann er über die Windows-Dienste-Oberfläche gestartet und gestoppt werden.
|
Dieses Kommando erfordert üblicherweise ein Administrator-Konto. Danach sollte für den Dienst-Start ein Dienst-User mit eingeschränkten Rechten angelegt werden. |
INSTALLATIONSVERZEICHNIS\karaf\bin\contrib\karaf-service-win.exe install
Weitere mögliche Operationen sind:
-
uninstall
-
stop
-
start
-
status
-
restart
Falls im Abschnitt Karaf die Umgebungsvariablen für den Betriebssystem-User und nicht systemweit gesetzt wurden, muss hier mit dem Betriebssystem-User ausgeführt werden. Da diesem wahrscheinlich die nötigen Rechte fehlen, müssen im jeweiligen Eingabeaufforderungs-Fenster die oben genannten Umgebungsvariablen temporär auch noch einmal gesetzt werden.
INSTALLATION DIRECTORY\karaf\bin\contrib\karaf-service-win.exe start
For more information see Apache Karaf Container Documentation - Windows.