Hi,
I made an attempt to use OrientDB (V 0.9.25) as a Windows service
(under Windows Server Enterprise Edition SP2 32 bit). The result is
not completely positive, but it seems to work and can provide hints to
improve the solution and solve the exissting issues.
I used the Apache Procrun (
http://commons.apache.org/daemon/
procrun.html) to wrap the OrientDB Java executable and install it as
Windows service.
On the Apache procrun page you can find details on how to use the 2
Procrun executables (the wrapper and the management app).
To install the service I've copied the 2 procrun exe files to the
OrientdDB bin folder and renamed them as: OrientDB.exe (the wrapper)
and OrientDBw.exe (the managment app). Then I've created a BAT textual
file with the following command (sorry, it's a very long command):
OrientDB.exe //IS//OrientDB --DisplayName="OrientDB" --
Description="OrientDB Java Document Database Server" --Startup=manual
--LogPath=C:\OrientDB\log --LogLevel=INFO --LogPrefix=OrientDB --
StdOutput=auto --StdError=auto --StartPath=C:\OrientDB --
StartClass=com.orientechnologies.orient.server.OServerMain --
StartMethod=main --StartParams=start --StartMode=jvm --StopPath=C:
\OrientDB --
StopClass=com.orientechnologies.orient.server.OServerShutdownMain --
StopMethod=OServerShutdownMain --StopParams=shutdown --StopMode=jvm --
Jvm="C:\Program Files\Java\jdk1.6.0_24\jre\bin\server\jvm.dll" --
Classpath=%ORIENTDB_HOME%\lib\orientdb-server-0.9.25.jar --JvmOptions=-
XX:+UseParallelGC ++JvmOptions=-XX:+AggressiveOpts ++JvmOptions=-
XX:CompileThreshold=200 ++JvmOptions=-
Djava.util.logging.config.file="%ORIENTDB_HOME%/config/orientdb-server-
log.properties" ++JvmOptions=-Dorientdb.config.file="%ORIENTDB_HOME%/
config/orientdb-server-config.xml" ++JvmOptions=-
Dorientdb.www.path="%ORIENTDB_HOME%/www" ++JvmOptions=-
Dlog.console.level=info ++JvmOptions=-Dlog.file.level=fine
The "//IS//OrientDB" is the instruction to procrun (I've renamed it
OrientDB.exe) to install ("IS") my service assigning it the name
"OrientDB" (this is the name you'll see under Services app in Windows
Administrative tools); the "Description" option is obvious;
"Startup=manual" means that the Windows service has to started
manually. I'm quite sure the "StartClass" "StartMethod",
"StartParams", "StopClass", "StopMethod" and "StopParams" have to be
revised. I guessed them taking into account the provided server.bat
and shutdown.bat.
I've specified my Java DLL (the server version) location using the
"Jvm" parameter and my OrientDB jar file with the "Classpath"
parameter.
Finally the "JvmOptions" specify the Java options as reported in the
OrientDB server.bat. Pay attention that the 1st "JvmOptions" must be
specified using the "--" prefix, while the others have to use the "++"
one.
I've also set an environment variable ("OrientDB_HOME") to pint to the
home fodler of my orietDB instalaltion.
launching that command successufully install OrientDB as a windows
service. You can start the service and use it. After starting the
service in the log folder you specified you'll find 3 files
(OrientDB.YYYY-MM-DD.log, orientdb-stderr.YYYY-MM-DD.log and orientdb-
stdout.YYYY-MM-DD.log) that report the outcome of the starting
process.
The orientdb-stderr file reports the following:
2011-05-01 20:32:14 Commons Daemon procrun stderr initialized
Can't load log handler "java.util.logging.FileHandler"
java.io.IOException: Couldn't get lock for ../log/orient-server.log
java.io.IOException: Couldn't get lock for ../log/orient-server.log
at java.util.logging.FileHandler.openFiles(FileHandler.java:372)
at java.util.logging.FileHandler.<init>(FileHandler.java:208)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at java.util.logging.LogManager$3.run(LogManager.java:358)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:
344)
at
java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:
909)
at java.util.logging.LogManager.access$900(LogManager.java:128)
at java.util.logging.LogManager
$RootLogger.getHandlers(LogManager.java:990)
at
com.orientechnologies.common.log.OLogManager.<init>(OLogManager.java:
30)
at
com.orientechnologies.common.log.OLogManager.<clinit>(OLogManager.java:
24)
at com.orientechnologies.orient.core.config.OGlobalConfiguration
$5.change(OGlobalConfiguration.java:146)
at
com.orientechnologies.orient.core.config.OGlobalConfiguration.setValue(OGlobalConfiguration.java:
206)
at
com.orientechnologies.orient.core.config.OGlobalConfiguration.readConfiguration(OGlobalConfiguration.java:
285)
at
com.orientechnologies.orient.core.config.OGlobalConfiguration.<clinit>(OGlobalConfiguration.java:
173)
at com.orientechnologies.orient.server.OServer.<init>(OServer.java:
84)
at
com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:
23)
2011-05-01 08:32:17:753 INFO [OServer] OrientDB Server v0.9.25 is
starting up...
2011-05-01 08:32:22:349 INFO [OServer] -> Loaded memory database
'temp'
2011-05-01 08:32:22:750 INFO [OServerNetworkListener] Listening
distributed connections on localhost:2424
2011-05-01 08:32:22:770 INFO [OServerNetworkListener] Listening http
connections on localhost:2480
2011-05-01 08:32:26:686 INFO [OServer] OrientDB Server v0.9.25 is
active.
2011-05-01 08:32:29:690 WARN [ODistributedServerManager] Current node
is the new cluster Leader of distributed nodes
2011-05-01 08:32:29:690 INFO [ODistributedServerDiscoveryListener]
Listening for distributed nodes on IP multicast /
235.1.1.1:2424java.lang.NoSuchMethodError: OServerShutdownMain
It seems there are 2 problems:
* orientdb is not able to load the java.util.logging.FileHandler
* orientdb is not able to lock the orient-server.log file (but I
think this is due to the previous problem and to the absence of the
orient-server.log file!)
Apart from the above issues the program seems to be correctly running.
I've tried to submit some (very simple!) commands both via the console
program and the web UI and evething seems to be OK.
When you try to stop the new Windows service the OrientDB.YYYY-MM-
DD.log file reports a further error "Method 'static void
OServerShutdownMain(String[])' not found in Class com/
orientechnologies/orient/server/OServerShutdownMain" and the OrientDB
Windows service doesn't stop quietly.
I think the problem is due to errors in the "StopClass", "StopMethod"
and "StopParams" parameters I specified.
I've also treid to start an additional oreintDB server in cluster with
the Windows service one. The additional OrientDB server seems to join
the cluster (even if the OrientDB Widnows service logs doesn't report
any info, but perhaps this is due to the above issues).
Anyway the clustered config seems having problems by itself (I was
still unable to share a database among 2 orientdb instances started
using the server.bat file).
Hoping the above report helps others. Sorry for the long message. ciao
Domenico