3,744 bytes added
, 01:02, 8 April 2016
BaseX server can be configured to run as an always-on service in Windows (or Linux) using [http://yajsw.sourceforge.net/ YAJSW]. The instructions on this page are known to work using Windows Server 2012R2, BaseX 8.4.2, YAJSW 12.05 beta, Java 1.8.0_77 64-bit from Oracle.
== Some basics of YAJSW ==
* Each service running with YAJSW has a configuration file which lives in the <code>conf</code> folder.
* Installing and controlling services is done from the command line. Run a command prompt as administrator, then navigate to the folder where you placed YAJSW, e.g. <code>cd C:\Programs\yajsw\yajsw-beta-12.05</code>
* If you need to change configuration of a service follow this sequence:
*# Stop the service <code>java -jar wrapper.jar --stop conf\wrapper.name.conf</code>
*# Remove the service <code>java -jar wrapper.jar --remove conf\wrapper.name.conf</code>
*# Make your changes to the wrapper or application configuration.
*# Install the service <code>java -jar wrapper.jar --install conf\wrapper.name.conf</code>
*# Start the service <code>java -jar wrapper.jar --start conf\wrapper.name.conf</code>
YAJSW comes with some helpful convenience scripts in the 'bat' and 'bin' folders. This set of instructions does not use these convenience scripts.
== Gather the files ==
* Download the latest version of BaseX
* Download the latest version of YAJSW
* Download the latest version of Java
== Install Java ==
Install Java using the Java installer for your operating system. Use a 64-bit version if you can.
== Put files into position ==
These instructions assume you will be placing BaseX and YAJSW in C:\Programs, but you can choose a different location.
# Create folder <code>C:\Programs</code>
# Extract YAJSW to <code>C:\Programs\yajsw\yajsw-beta-12.05</code>
# Extract BaseX to <code>C:\Programs\BaseX\basex</code>
== Install BaseX as a service ==
Create wrapper config file <code>wrapper.basex.conf</code> and place it in YAJSW's <code>conf</code> folder. You can use the example below. You may need to modify this example to:
* Specify the location of java.exe
* Increase the amount of memory available to BaseX from 512m (for example, 2048m)
<pre>
# YAJSW configuration for BaseX
wrapper.java.command=C:/Program Files/Java/jre1.8.0_77/bin/java.exe
wrapper.working.dir=C:\\Programs\\BaseX\\basex
wrapper.java.app.mainclass=org.basex.BaseXHTTP
wrapper.java.classpath.1 = .\\BaseX.jar
wrapper.java.classpath.2 = .\\lib\\*.jar
wrapper.java.additional.1 = -Xmx512m
wrapper.java.additional.2 = -Dfile.encoding=utf-8
wrapper.ntservice.name=BaseX
wrapper.ntservice.displayname=BaseX
wrapper.ntservice.description=BaseX XQuery database
wrapper.console.loglevel=INFO
wrapper.logfile=${wrapper.working.dir}\\data\\.logs\\wrapper-basex.log
wrapper.logfile.maxsize=10m
wrapper.logfile.maxfiles=10
wrapper.on_exit.0=SHUTDOWN
wrapper.on_exit.default=RESTART
</pre>
After you have created the wrapper configuration file:
# Open a command prompt as administrator and navigate to the YAJSW folder <code>cd C:\Programs\yajsw\yajsw-beta-12.05</code>
# Install the service: <code>java -jar wrapper.jar --install conf\wrapper.basex.conf</code>
# Start the service: <code>java -jar wrapper.jar --start conf\wrapper.basex.conf</code>
# Open a web browser and go to http://localhost:8984/dba (or http://host:8984/dba from your computer, replace 'host' with the address of the server) to open the database administration web console.
# Log in with username 'admin' password 'admin'
# Click on ''Users'' to navigate to the user management screen.
# Click on the ''admin'' user
# Set a password for the admin user and then click Save.
BaseX server is now running as a service, and will start automatically when Windows starts.