Friday, 3 February 2012

Configure Cassandra as a Windows Service

1. Download binary tarball of Cassandra. (Make sure you are having all the prerequisites)
http://cassandra.apache.org/download/

2. Unzip this archive to a directory say D:\apache-cassandra-1.0.7.

3. Run cassandra.bat from bin folder to make sure its up and running.

4. Close this and now lets try and install it as a windows service.

5. Open command prompt, point to  D:\apache-cassandra-1.0.7\bin and run "cassandra.bat install".

6. This will give the right message, but it won't be installed. 

7. Make a folder daemon on this path "D:\apache-cassandra-1.0.7-bin\bin\daemon".

8. Download prunsrv.exe from http://www.apache.org/dist/commons/daemon/binaries/windows/ (Commons Daemon Service Runner)

9. Extract the correct version(32/64 bit) of prunsrv.exe from the above to D:\apache-cassandra-1.0.7-bin\bin\daemon. 

10. Now again Open command prompt, point to  D:\apache-cassandra-1.0.7\bin and run "cassandra.bat install". 


11. Now run "cassandra" service from Services Manger. 

12. To uninstall, Open command prompt, point to  D:\apache-cassandra-1.0.7\bin and run "cassandra.bat uninstall".

Make sure you choose 32/64 bit prunsrv.exe based on jre installed(32/64 bit) and not necessarily based on your Windows (32/64 bit).
You may get error like this in log file... 
[2012-02-04 11:04:24] [info]  Commons Daemon procrun (1.0.8.0 64-bit) started
[2012-02-04 11:04:24] [info]  Running 'cassandra' Service...
[2012-02-04 11:04:24] [info]  Starting service...
[2012-02-04 11:04:24] [error] Failed creating java 
[2012-02-04 11:04:24] [error] The system cannot find the file specified.
[2012-02-04 11:04:24] [error] ServiceStart returned 1
[2012-02-04 11:04:24] [error] The system cannot find the file specified.
[2012-02-04 11:04:24] [info]  Run service finished.
[2012-02-04 11:04:24] [info]  Commons Daemon procrun finished



This is because there is a mismatch between the jre expected by prunsrv.exe and the jre installed on your machine. 

To locate this on Task Manager, look for process with image name "prunsrv.exe". 


2 comments:

  1. Cassandra being more suitable for real time transaction processing and the serving of interactive data.

    ReplyDelete
  2. Cassandra being more suitable for real time transaction processing and the serving of interactive data.

    ReplyDelete