Installing OrientDB as Windows service

1,076 views
Skip to first unread message

Dom54

unread,
May 1, 2011, 5:02:25 PM5/1/11
to OrientDB
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

Luca Garulli

unread,
May 2, 2011, 9:13:52 AM5/2/11
to orient-database
Ciao Domenico,
interesting! Why don't you share your stuff as attachments of the issue 61? http://code.google.com/p/orient/issues/detail?id=61

I can try it and see what happens with log files. If it needs I could create a new parameter to specify the log folder.

Lvc@

Dom54

unread,
May 2, 2011, 11:14:42 AM5/2/11
to OrientDB
Ciao,
I've reported a summary under issue 61.
I've not added any attachement (apart from a link to this posting)
because all detials are already in my yesterday post.
To reply my attempt simply download Procrun, copy the 2 EXEs and
rename it as indicated, create the ORIENTDB_HOME environment variable
and execute the long command I've reported.
Then, using the Windows services management console or the
OrientDBw.exe procrun app, start the newly installed service and see
what happens.
Pay attention that to actually stop the service is not sufficient to
stop it as a service you must restart your PC because OrientDB remains
in an undefined state (that's why I used a VM for my attempts).
The same problem exists to actually uninstall the service. If you have
started the service and then you want to uninstall it you can run the
deinstall command (execute "OrientDB.exe //DS//OrientDB" if you used
my command version), but the actual deinstall is done when the machine
reboots due to the issues in stopping the service.
Hoping this helps. Ciao
Dom

On May 2, 3:13 pm, Luca Garulli <l.garu...@gmail.com> wrote:
> Ciao Domenico,
> interesting! Why don't you share your stuff as attachments of the issue 61?http://code.google.com/p/orient/issues/detail?id=61
>
> <http://code.google.com/p/orient/issues/detail?id=61>I can try it and see
> what happens with log files. If it needs I could create a new parameter to
> specify the log folder.
>
> Lvc@
>

Luca Garulli

unread,
May 3, 2011, 9:16:55 AM5/3/11
to orient-database
Thank you Domenico,
the issue is planned for release 1.1 but hope to bring it forward (http://code.google.com/p/orient/issues/detail?id=61)

Lvc@

Domenico Rotondi

unread,
Sep 8, 2011, 5:47:51 AM9/8/11
to Adolfo Rodriguez, orient-...@googlegroups.com
On 7 Sep 2011 at 16:41, Adolfo Rodriguez wrote:
Hi,
the wiki page you mention on installing Orient-DB as Windows service actually
solves the problem reported in issue 61; so there is no need to have specific scripts in
the Orient-DB kit.
Simply follow the recipe in the wiki page and you got the objective of having Orient-
DB active as a service.
Hoping this clarifies the floor.
CIao
Domenico
> Hi all, I am a bit confused with the instalation OrientDB as a Service
> (Win) or Daemon (Linux) as this thread discussed.
>
> As a Win Service:
> * I have seen a pending issue 'Issue 61: Install as Windows Service'
> scheduled for 1.1.
> * I have seen this wiki entry http://code.google.com/p/orient/wiki/WrappingAsAWindowsService
> * However, I do not see any script in bin directory n latest
> deliverables
>
> Despite is not my main concern right now, I am a bit messed up as
> there is a wiki entry, a pending issue but there is not script in bin.
> What is the current state for Win Service?
>
>
> As a Linux daemon:
> * I was planing to fight myself with http://commons.apache.org/daemon/jsvc.html
> and create the start script.
> * However, I realised that the script orientdb.sh (script which seems
> to intend to launch orientdb as a daemon) is already provided in bin
> (despite I am unable to make it work, it complains with error).
>
> This is the case I want to use as I am replacing my previous DB with
> OrientDB in CentOS for my project. Is orientdb.sh script expected to
> work? No entry in wiki? Again, what is the current status for Daemons?
>
>
> Thanks,
>
> Adolfo

>
>
>
> On May 2, 5:14 pm, Dom54 <D.Roto...@Computer.Org> wrote:
> > Ciao,
> > I've reported a summary under issue 61.
> > I've not added any attachement (apart from a link to this posting)
> > because all detials are already in my yesterday post.
> > To reply my attempt simply download Procrun, copy the 2 EXEs and
> > rename it as indicated, create the ORIENTDB_HOME environment variable
> > and execute the long command I've reported.
> > Then, using the Windows services management console or the
> > OrientDBw.exe procrun app, start the newly installedserviceand see
> > what happens.
> > Pay attention that to actually stop theserviceis not sufficient to
> > stop it as aserviceyou must restart your PC because OrientDB remains

> > in an undefined state (that's why I used a VM for my attempts).
> > The same problem exists to actually uninstall theservice. If you have
> > started theserviceand then you want to uninstall it you can run the

> > deinstall command (execute "OrientDB.exe //DS//OrientDB" if you used
> > my command version), but the actual deinstall is done when the machine
> > reboots due to the issues in stopping theservice.
> > Hoping this helps. Ciao
> >    Dom
> >
> > On May 2, 3:13 pm, Luca Garulli <l.garu...@gmail.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Ciao Domenico,
> > > interesting! Why don't you share your stuff as attachments of the issue 61?http://code.google.com/p/orient/issues/detail?id=61
> >
> > > <http://code.google.com/p/orient/issues/detail?id=61>I can try it and see
> > > what happens with log files. If it needs I could create a new parameter to
> > > specify the log folder.
> >
> > > Lvc@
> >
> > > On 1 May 2011 23:02, Dom54 <D.Roto...@computer.org> wrote:
> >
> > > > Hi,
> > > > I made an attempt to use OrientDB (V 0.9.25) as a Windowsservice
> > > > (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
> > > > Windowsservice.
> > > > 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 theserviceI'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") myserviceassigning 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 Windowsservicehas 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 theserviceand use it. After starting the
> > > >servicein the log folder you specified you'll find 3 files
> > > > When you try to stop the new Windowsservicethe 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
> > > > Windowsservicedoesn'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 Windowsserviceone. The additional OrientDB server seems to join
> > > > the cluster (even if the OrientDB Widnowsservicelogs doesn't report

Luca Garulli

unread,
Sep 8, 2011, 5:50:40 AM9/8/11
to orient-...@googlegroups.com, Adolfo Rodriguez
Hi,
about the unix script "orientdb.sh" you told it doesn't work with errors, but what errors?

Lvc@

Adolfo Rodriguez

unread,
Sep 8, 2011, 9:10:55 AM9/8/11
to OrientDB
yes Domenico, I got confused with the mismatch between an open issue
and a wiki entry.
I understand that is just result of some work in parallel. I will give
it a try to the service functionality.

Thanks
Adolfo

On Sep 8, 11:47 am, "Domenico Rotondi" <D.Roto...@Computer.Org> wrote:
> On 7 Sep 2011 at 16:41, Adolfo Rodriguez wrote:
> Hi,
> the wiki page you mention on installing Orient-DB as Windows service actually
> solves the problem reported in issue 61; so there is no need to have specific scripts in
> the Orient-DB kit.
> Simply follow the recipe in the wiki page and you got the objective of having Orient-
> DB active as a service.
> Hoping this clarifies the floor.
> CIao
>    Domenico
>
>
>
>
>
>
>
> > Hi all, I am a bit confused with the instalation OrientDB as a Service
> > (Win) or Daemon (Linux) as this thread discussed.
>
> > As a Win Service:
> > * I have seen a pending issue 'Issue 61: Install as Windows Service'
> > scheduled for 1.1.
> > * I have seen this wiki entryhttp://code.google.com/p/orient/wiki/WrappingAsAWindowsService
> > * However, I do not see any script in bin directory n latest
> > deliverables
>
> > Despite is not my main concern right now, I am a bit messed up as
> > there is a wiki entry, a pending issue but there is not script in bin.
> > What is the current state for Win Service?
>
> > As a Linux daemon:
> > * I was planing to fight myself withhttp://commons.apache.org/daemon/jsvc.html
> ...
>
> read more »

Adolfo Rodriguez

unread,
Sep 8, 2011, 9:18:25 AM9/8/11
to OrientDB
After setting my 2 variables at the top of the file:

ORIENTDB_DIR="/opt/orientdb"
ORIENTDB_USER="orientdb"

I am getting an error after running:

# ./orientdb.sh start
Starting OrientDB server daemon...
./orientdb.sh: line 52: return: can only `return' from a function or
sourced script
Usage: orientdb.sh: <start|stop|status>

It looks unable to recognize the bash/scriptting language??

No problems at all running server.sh.

Adolfo



On Sep 8, 11:50 am, Luca Garulli <l.garu...@gmail.com> wrote:
> Hi,
> about the unix script "orientdb.sh" you told it doesn't work with errors,
> but what errors?
>
> Lvc@
>
> ...
>
> read more »

Adolfo Rodriguez

unread,
Sep 8, 2011, 9:27:30 AM9/8/11
to OrientDB
However, if I do another execution it says that daemon is already
started and port 2480 is listening.

# ./orientdb.sh start
OrientDB server daemon was already started. PID: 22229
./orientdb.sh: line 52: return: can only `return' from a function or
sourced script
Usage: orientdb.sh: <start|stop|status>

But still do not understand the "return: can only `return' from a
function or sourced script" error.

Adolfo
> ...
>
> read more »

dAm2K

unread,
Sep 8, 2011, 10:23:12 AM9/8/11
to orient-...@googlegroups.com
2011/9/8 Adolfo Rodriguez <pelly...@yahoo.es>:

>
> But still do not understand the "return: can only `return' from a
> function or sourced script" error.
>
> Adolfo

Bash permits the "return" statement only if it's called from inside a
function block.
The orientdb init script call "return" inside the main block.

The small patch in attach can be applied with:

# cd [your_orientdb_home]/bin
# patch -p0 < orientdb.sh.patch


Luca, if you want you can apply the patch to the mainstream orientdb svn.
Ciao, Dino Ciuffetti.

--
dAm2K, you know I'm there!

orientdb.sh.patch

Luca Garulli

unread,
Sep 8, 2011, 10:34:32 AM9/8/11
to orient-...@googlegroups.com
Thanks Dino,
I've patched the file in SVN trunk (SVn r3804).

Lvc@

Adolfo Rodriguez

unread,
Sep 8, 2011, 10:43:37 AM9/8/11
to OrientDB
Hi dAm2K,

I can confirm that, with your fix, the script orientdb.sh works like a
charm.

+1 for me to add this fix to the deliverable.

Very very appreciated, I hate *NIX scripting. :-)

Adolfo



On Sep 8, 4:23 pm, dAm2K <dam2...@gmail.com> wrote:
> 2011/9/8 Adolfo Rodriguez <pellyado...@yahoo.es>:
>  orientdb.sh.patch
> < 1KViewDownload
Reply all
Reply to author
Forward
0 new messages