| by Arround The Web | No comments

Cassandra Run as a Windows Service

When running the Apache Cassandra server on Windows, it can be repetitive to manually start and stop the server every time you need to use it. As developers, it is our task to automate tedious and repetitive tasks so we can focus on more important things, like removing bugs.

In this post, we will discuss how you can set up the starting and stopping of the Apache Cassandra server as a Windows service. This will allow the Windows service manager to start and stop the server on startup and shutdown.

NOTE: Before proceeding with this tutorial, we assume you have the Apache Cassandra server configured and set up on your Windows Machine. If not, check our installation tutorial on the topic to learn more.

Step 1 – Download the Apache Commons Daemon

To run the Apache Cassandra server as a service, we need the Apache Commons daemon, which provides a single entry for managing client-side Java Applications using the Java Virtual Machine.

Open your browser and head  to:

https://downloads.apache.org/commons/daemon/binaries/windows/

Download the Apache Commons Deamon binary and save it on your local machine.

Step 2 – Extract the Downloaded Archive

Once downloaded, extract the archive and save it in an accessible directory. In our example, we will save the file in the C:\commons-daemon directory.

Step 3 – Configure Daemons Folder in Apache Cassandra

Next, locate the bin directory in the Apache Cassandra installation directory, which holds the server’s startup files.

In the bin directory, create a new daemon directory.

Step 4 – Copy PRUNSRV.EXE

In the Apache Commons directory you extracted, locate the prunsrv.exe file. If you are on a 64bit machine, use the prunsrv.exe file located in the amd64 directory.

Copy the prunsrv.exe file into the daemons directory you created earlier.

Step 6 – Install the Apache Cassandra Service

Once you have copied the prunsrv.exe binary, open the command prompt as administrator and navigate to the Cassandra bin directory:

$ cd C:\cassandra\bin

Next, run the command below to install the Cassandra service:

$ cassandra.bat -install

The command above will install the Cassandra service on your machine.

You can then use Windows Manager to start or stop the Cassandra server.

Conclusion

In this post, you discovered how to use the Apache Commons Daemon to run the Cassandra Server as a Windows service.

Share Button

Source: linuxhint.com

Leave a Reply